docstr: Train a model for a fixed number of epochs on a DataSet.
  
  # Arguments
  x: Input data. A Numpy array or RDD of Sample, ImageSet or TextSet.
  y: Labels. A Numpy array. Default is None if x is already Sample RDD or ImageSet or TextSet.
  batch_size: Number of samples per gradient update. Default is 32.
  nb_epoch: Number of epochs to train.
  validation_data: Tuple (x_val, y_val) where x_val and y_val are both Numpy arrays.
                   Can also be RDD of Sample or ImageSet or TextSet.
                   Default is None if no validation is involved.
  distributed: Boolean. Whether to train the model in distributed mode or local mode.
               Default is True. In local mode, x and y must both be Numpy arrays.
docstr_tok: ["Train","a","model","for","a","fixed","number","of","epochs","on","a","DataSet",".","#","Arguments","x",":","Input","data",".","A","Numpy","array","or","RDD","of","Sample",",","ImageSet","or","TextSet",".","y",":","Labels",".","A","Numpy","array",".","Default","is","None","if","x","is","already","Sample","RDD","or","ImageSet","or","TextSet",".","batch_size",":","Number","of","samples","per","gradient","update",".","Default","is","32.","nb_epoch",":","Number","of","epochs","to","train",".","validation_data",":","Tuple","(","x_val",",","y_val",")","where","x_val","and","y_val","are","both","Numpy","arrays",".","Can","also","be","RDD","of","Sample","or","ImageSet","or","TextSet",".","Default","is","None","if","no","validation","is","involved",".","distributed",":","Boolean",".","Whether","to","train","the","model","in","distributed","mode","or","local","mode",".","Default","is","True",".","In","local","mode",",","x","and","y","must","both","be","Numpy","arrays","."]
code: def fit(
      self,
      x,
      y=None,
      batch_size=32,
      nb_epoch=10,
      validation_split=0,
      validation_data=None,
      distributed=True,
  ):
      """
      Train a model for a fixed number of epochs on a DataSet.
  
      # Arguments
      x: Input data. A Numpy array or RDD of Sample, ImageSet or TextSet.
      y: Labels. A Numpy array. Default is None if x is already Sample RDD or ImageSet or TextSet.
      batch_size: Number of samples per gradient update. Default is 32.
      nb_epoch: Number of epochs to train.
      validation_data: Tuple (x_val, y_val) where x_val and y_val are both Numpy arrays.
                       Can also be RDD of Sample or ImageSet or TextSet.
                       Default is None if no validation is involved.
      distributed: Boolean. Whether to train the model in distributed mode or local mode.
                   Default is True. In local mode, x and y must both be Numpy arrays.
      """
  
      if distributed:
          if isinstance(x, np.ndarray) and isinstance(y, np.ndarray):
              if validation_data:
                  validation_data = to_sample_rdd(*validation_data)
              elif validation_split != 0:
                  if validation_split > 1 or validation_split < 0:
                      raise TypeError(
                          "validation split must in range [0, 1]"
                      )
                  split_index = int(len(x) * (1 - validation_split))
                  validation_data = (x[split_index:], y[split_index:])
                  x, y = x[:split_index], y[:split_index]
                  validation_data = to_sample_rdd(*validation_data)
              training_data = to_sample_rdd(x, y)
          elif (
              (
                  isinstance(x, RDD)
                  or isinstance(x, ImageSet)
                  or isinstance(x, TextSet)
              )
              or isinstance(x, FeatureSet)
              and not y
          ):
              training_data = x
          else:
              raise TypeError(
                  "Unsupported training data type: %s" % type(x)
              )
          callZooFunc(
              self.bigdl_type,
              "zooFit",
              self.value,
              training_data,
              batch_size,
              nb_epoch,
              validation_data,
          )
      else:
          if validation_data:
              val_x = [
                  JTensor.from_ndarray(x)
                  for x in to_list(validation_data[0])
              ]
              val_y = JTensor.from_ndarray(validation_data[1])
          else:
              val_x, val_y = None, None
          callZooFunc(
              self.bigdl_type,
              "zooFit",
              self.value,
              [JTensor.from_ndarray(x) for x in to_list(x)],
              JTensor.from_ndarray(y),
              batch_size,
              nb_epoch,
              val_x,
              val_y,
          )
  
imports: import zoo.pipeline.api.autograd
  from zoo.feature.image import ImageSet
  from zoo.feature.text import TextSet
  from zoo.feature.common import FeatureSet
  from zoo.pipeline.api.keras.base import ZooKerasLayer
  from zoo.pipeline.api.keras.utils import *
  from bigdl.nn.layer import Layer
  from zoo.common.utils import callZooFunc
label_desc: Use image node_id 12 for calling the KerasNet obj's underlying member method code with example usage: obj.fit(x, y, batch_size, nb_epoch, validation_split, validation_data, distributed) without return types