class_docstr: .. note:: `bigdl.dllib.keras` is deprecated in 0.11.
  This will be removed in future releases.
class_docstr_tok: ["..","note",":",":","`","bigdl.dllib.keras","`","is","deprecated","in","0.11",".","This","will","be","removed","in","future","releases","."]
docstr: Train a model for a fixed number of epochs on a dataset.
  
  # Arguments
  x: Input data. A Numpy array or RDD of Sample or Image DataSet.
  y: Labels. A Numpy array. Default is None if x is already RDD of Sample or Image DataSet.
  batch_size: Number of samples per gradient update.
  nb_epoch: Number of iterations to train.
  validation_data: Tuple (x_val, y_val) where x_val and y_val are both Numpy arrays.
                   Or RDD of Sample. 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","or","Image","DataSet",".","y",":","Labels",".","A","Numpy","array",".","Default","is","None","if","x","is","already","RDD","of","Sample","or","Image","DataSet",".","batch_size",":","Number","of","samples","per","gradient","update",".","nb_epoch",":","Number","of","iterations","to","train",".","validation_data",":","Tuple","(","x_val",",","y_val",")","where","x_val","and","y_val","are","both","Numpy","arrays",".","Or","RDD","of","Sample",".","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_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 or Image DataSet.
      y: Labels. A Numpy array. Default is None if x is already RDD of Sample or Image DataSet.
      batch_size: Number of samples per gradient update.
      nb_epoch: Number of iterations to train.
      validation_data: Tuple (x_val, y_val) where x_val and y_val are both Numpy arrays.
                       Or RDD of Sample. 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):
              training_data = to_sample_rdd(x, y)
              if validation_data:
                  validation_data = to_sample_rdd(*validation_data)
          elif (isinstance(x, RDD) or isinstance(x, DataSet)) and not y:
              training_data = x
          else:
              invalidInputError(
                  False, "Unsupported training data type: %s" % type(x)
              )
          callBigDlFunc(
              self.bigdl_type,
              "fit",
              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
          callBigDlFunc(
              self.bigdl_type,
              "fit",
              self.value,
              [JTensor.from_ndarray(x) for x in to_list(x)],
              JTensor.from_ndarray(y),
              batch_size,
              nb_epoch,
              val_x,
              val_y,
              multiprocessing.cpu_count(),
          )
  
imports: from bigdl.dllib.nn.keras.layers.layer import KerasLayer
  from bigdl.dllib.optim.optimizer import *
  from bigdl.dllib.nn.criterion import *
  from bigdl.dllib.utils.log4Error import *
  import multiprocessing
  import warnings
  from bigdl.dllib.nn.layer import SharedStaticUtils, Container
label_desc: Use image node_id 5 for calling the KerasModel obj's underlying member method code with example usage: obj.fit(x, y, batch_size, nb_epoch, validation_data, distributed) without return types