parameters: (self,
            x=None,
            y=None,
            batch_size=None,
            epochs=1,
            verbose=1,
            callbacks=None,
            validation_split=0.,
            validation_data=None,
            shuffle=True,
            class_weight=None,
            sample_weight=None,
            initial_epoch=0,
            steps_per_epoch=None,
            validation_steps=None)
return_statement: return self._fit_loop(
          f,
          ins,
          out_labels=out_labels,
          batch_size=batch_size,
          epochs=epochs,
          verbose=verbose,
          callbacks=callbacks,
          val_f=val_f,
          val_ins=val_ins,
          shuffle=shuffle,
          callback_metrics=callback_metrics,
          initial_epoch=initial_epoch,
          steps_per_epoch=steps_per_epoch,
          validation_steps=validation_steps)
docstring: Trains the model for a fixed number of epochs (iterations on a dataset).
  
      Arguments:
          x: Numpy array of training data,
              or list of Numpy arrays if the model has multiple inputs.
              If all inputs in the model are named,
              you can also pass a dictionary
              mapping input names to Numpy arrays.
          y: Numpy array of target data,
              or list of Numpy arrays if the model has multiple outputs.
              If all outputs in the model are named,
              you can also pass a dictionary
              mapping output names to Numpy arrays.
          batch_size: Integer or `None`.
              Number of samples per gradient update.
              If unspecified, it will default to 32.
          epochs: Integer, the number of times to iterate
              over the training data arrays.
          verbose: 0, 1, or 2. Verbosity mode.
              0 = silent, 1 = verbose, 2 = one log line per epoch.
          callbacks: List of callbacks to be called during training.
              See [callbacks](/callbacks).
          validation_split: Float between 0 and 1:
              fraction of the training data to be used as validation data.
              The model will set apart this fraction of the training data,
              will not train on it, and will evaluate
              the loss and any model metrics
              on this data at the end of each epoch.
          validation_data: Data on which to evaluate
              the loss and any model metrics
              at the end of each epoch. The model will not
              be trained on this data.
              This could be a tuple (x_val, y_val)
              or a tuple (x_val, y_val, val_sample_weights).
          shuffle: Boolean, whether to shuffle the training data
              before each epoch. Has no effect when `steps_per_epoch`
              is not `None`.
          class_weight: Optional dictionary mapping
              class indices (integers) to
              a weight (float) to apply to the model's loss for the samples
              from this class during training.
              This can be useful to tell the model to "pay more attention" to
              samples from an under-represented class.
          sample_weight: Optional array of the same length as x, containing
              weights to apply to the model's loss for each sample.
              In the case of temporal data, you can pass a 2D array
              with shape (samples, sequence_length),
              to apply a different weight to every timestep of every sample.
              In this case you should make sure to specify
              sample_weight_mode="temporal" in compile().
          initial_epoch: Epoch at which to start training
              (useful for resuming a previous training run)
          steps_per_epoch: Total number of steps (batches of samples)
              before declaring one epoch finished and starting the
              next epoch. When training with Input Tensors such as
              TensorFlow data tensors, the default `None` is equal to
              the number of unique samples in your dataset divided by
              the batch size, or 1 if that cannot be determined.
          validation_steps: Only relevant if `steps_per_epoch`
              is specified. Total number of steps (batches of samples)
              to validate before stopping.
  
      Returns:
          A `History` instance. Its `history` attribute contains
          all information collected during training.
  
      Raises:
          ValueError: In case of mismatch between the provided input data
              and what the model expects.
docstring_summary: Trains the model for a fixed number of epochs (iterations on a dataset).
docstring_tokens: Trains the model for a fixed number of epochs ( iterations on a dataset ) .
function: def fit(self,
            x=None,
            y=None,
            batch_size=None,
            epochs=1,
            verbose=1,
            callbacks=None,
            validation_split=0.,
            validation_data=None,
            shuffle=True,
            class_weight=None,
            sample_weight=None,
            initial_epoch=0,
            steps_per_epoch=None,
            validation_steps=None):
      """Trains the model for a fixed number of epochs (iterations on a dataset).
  
      Arguments:
          x: Numpy array of training data,
              or list of Numpy arrays if the model has multiple inputs.
              If all inputs in the model are named,
              you can also pass a dictionary
              mapping input names to Numpy arrays.
          y: Numpy array of target data,
              or list of Numpy arrays if the model has multiple outputs.
              If all outputs in the model are named,
              you can also pass a dictionary
              mapping output names to Numpy arrays.
          batch_size: Integer or `None`.
              Number of samples per gradient update.
              If unspecified, it will default to 32.
          epochs: Integer, the number of times to iterate
              over the training data arrays.
          verbose: 0, 1, or 2. Verbosity mode.
              0 = silent, 1 = verbose, 2 = one log line per epoch.
          callbacks: List of callbacks to be called during training.
              See [callbacks](/callbacks).
          validation_split: Float between 0 and 1:
              fraction of the training data to be used as validation data.
              The model will set apart this fraction of the training data,
              will not train on it, and will evaluate
              the loss and any model metrics
              on this data at the end of each epoch.
          validation_data: Data on which to evaluate
              the loss and any model metrics
              at the end of each epoch. The model will not
              be trained on this data.
              This could be a tuple (x_val, y_val)
              or a tuple (x_val, y_val, val_sample_weights).
          shuffle: Boolean, whether to shuffle the training data
              before each epoch. Has no effect when `steps_per_epoch`
              is not `None`.
          class_weight: Optional dictionary mapping
              class indices (integers) to
              a weight (float) to apply to the model's loss for the samples
              from this class during training.
              This can be useful to tell the model to "pay more attention" to
              samples from an under-represented class.
          sample_weight: Optional array of the same length as x, containing
              weights to apply to the model's loss for each sample.
              In the case of temporal data, you can pass a 2D array
              with shape (samples, sequence_length),
              to apply a different weight to every timestep of every sample.
              In this case you should make sure to specify
              sample_weight_mode="temporal" in compile().
          initial_epoch: Epoch at which to start training
              (useful for resuming a previous training run)
          steps_per_epoch: Total number of steps (batches of samples)
              before declaring one epoch finished and starting the
              next epoch. When training with Input Tensors such as
              TensorFlow data tensors, the default `None` is equal to
              the number of unique samples in your dataset divided by
              the batch size, or 1 if that cannot be determined.
          validation_steps: Only relevant if `steps_per_epoch`
              is specified. Total number of steps (batches of samples)
              to validate before stopping.
  
      Returns:
          A `History` instance. Its `history` attribute contains
          all information collected during training.
  
      Raises:
          ValueError: In case of mismatch between the provided input data
              and what the model expects.
      """
      # Backwards compatibility
      if batch_size is None and steps_per_epoch is None:
        batch_size = 32
      if x is None and y is None and steps_per_epoch is None:
        raise ValueError('If fitting from data tensors, '
                         'you should specify the `steps_per_epoch` '
                         'argument.')
      # Validate user data.
      x, y, sample_weights = self._standardize_user_data(
          x,
          y,
          sample_weight=sample_weight,
          class_weight=class_weight,
          check_batch_axis=False,
          batch_size=batch_size)
  
      # Prepare validation data.
      do_validation = False
      val_ins = []
      if validation_data:
        do_validation = True
        if len(validation_data) == 2:
          val_x, val_y = validation_data  # pylint: disable=unpacking-non-sequence
          val_sample_weight = None
        elif len(validation_data) == 3:
          val_x, val_y, val_sample_weight = validation_data  # pylint: disable=unpacking-non-sequence
        else:
          raise ValueError(
              'When passing validation_data, '
              'it must contain 2 (x_val, y_val) '
              'or 3 (x_val, y_val, val_sample_weights) '
              'items, however it contains %d items' % len(validation_data))
  
        val_x, val_y, val_sample_weights = self._standardize_user_data(
            val_x,
            val_y,
            sample_weight=val_sample_weight,
            check_batch_axis=False,
            batch_size=batch_size)
        if self.uses_learning_phase and not isinstance(K.learning_phase(), int):
          val_ins = val_x + val_y + val_sample_weights + [0.]
        else:
          val_ins = val_x + val_y + val_sample_weights
  
      elif validation_split and 0. < validation_split < 1.:
        do_validation = True
        if hasattr(x[0], 'shape'):
          split_at = int(x[0].shape[0] * (1. - validation_split))
        else:
          split_at = int(len(x[0]) * (1. - validation_split))
        x, val_x = (_slice_arrays(x, 0, split_at), _slice_arrays(x, split_at))
        y, val_y = (_slice_arrays(y, 0, split_at), _slice_arrays(y, split_at))
        sample_weights, val_sample_weights = (_slice_arrays(
            sample_weights, 0, split_at), _slice_arrays(sample_weights, split_at))
        if self.uses_learning_phase and not isinstance(K.learning_phase(), int):
          val_ins = val_x + val_y + val_sample_weights + [0.]
        else:
          val_ins = val_x + val_y + val_sample_weights
  
      elif validation_steps:
        do_validation = True
        if self.uses_learning_phase and not isinstance(K.learning_phase(), int):
          val_ins = [0.]
  
      # Prepare input arrays and training function.
      if self.uses_learning_phase and not isinstance(K.learning_phase(), int):
        ins = x + y + sample_weights + [1.]
      else:
        ins = x + y + sample_weights
      self._make_train_function()
      f = self.train_function
  
      # Prepare display labels.
      out_labels = self._get_deduped_metrics_names()
  
      if do_validation:
        self._make_test_function()
        val_f = self.test_function
        callback_metrics = copy.copy(out_labels) + [
            'val_' + n for n in out_labels
        ]
      else:
        val_f = None
        callback_metrics = copy.copy(out_labels)
  
      # Delegate logic to `_fit_loop`.
      return self._fit_loop(
          f,
          ins,
          out_labels=out_labels,
          batch_size=batch_size,
          epochs=epochs,
          verbose=verbose,
          callbacks=callbacks,
          val_f=val_f,
          val_ins=val_ins,
          shuffle=shuffle,
          callback_metrics=callback_metrics,
          initial_epoch=initial_epoch,
          steps_per_epoch=steps_per_epoch,
          validation_steps=validation_steps)
function_tokens: def fit ( self , x = None , y = None , batch_size = None , epochs = 1 , verbose = 1 , callbacks = None , validation_split = 0. , validation_data = None , shuffle = True , class_weight = None , sample_weight = None , initial_epoch = 0 , steps_per_epoch = None , validation_steps = None ) : # Backwards compatibility if batch_size is None and steps_per_epoch is None : batch_size = 32 if x is None and y is None and steps_per_epoch is None : raise ValueError ( 'If fitting from data tensors, ' 'you should specify the `steps_per_epoch` ' 'argument.' ) # Validate user data. x , y , sample_weights = self . _standardize_user_data ( x , y , sample_weight = sample_weight , class_weight = class_weight , check_batch_axis = False , batch_size = batch_size ) # Prepare validation data. do_validation = False val_ins = [ ] if validation_data : do_validation = True if len ( validation_data ) == 2 : val_x , val_y = validation_data # pylint: disable=unpacking-non-sequence val_sample_weight = None elif len ( validation_data ) == 3 : val_x , val_y , val_sample_weight = validation_data # pylint: disable=unpacking-non-sequence else : raise ValueError ( 'When passing validation_data, ' 'it must contain 2 (x_val, y_val) ' 'or 3 (x_val, y_val, val_sample_weights) ' 'items, however it contains %d items' % len ( validation_data ) ) val_x , val_y , val_sample_weights = self . _standardize_user_data ( val_x , val_y , sample_weight = val_sample_weight , check_batch_axis = False , batch_size = batch_size ) if self . uses_learning_phase and not isinstance ( K . learning_phase ( ) , int ) : val_ins = val_x + val_y + val_sample_weights + [ 0. ] else : val_ins = val_x + val_y + val_sample_weights elif validation_split and 0. < validation_split < 1. : do_validation = True if hasattr ( x [ 0 ] , 'shape' ) : split_at = int ( x [ 0 ] . shape [ 0 ] * ( 1. - validation_split ) ) else : split_at = int ( len ( x [ 0 ] ) * ( 1. - validation_split ) ) x , val_x = ( _slice_arrays ( x , 0 , split_at ) , _slice_arrays ( x , split_at ) ) y , val_y = ( _slice_arrays ( y , 0 , split_at ) , _slice_arrays ( y , split_at ) ) sample_weights , val_sample_weights = ( _slice_arrays ( sample_weights , 0 , split_at ) , _slice_arrays ( sample_weights , split_at ) ) if self . uses_learning_phase and not isinstance ( K . learning_phase ( ) , int ) : val_ins = val_x + val_y + val_sample_weights + [ 0. ] else : val_ins = val_x + val_y + val_sample_weights elif validation_steps : do_validation = True if self . uses_learning_phase and not isinstance ( K . learning_phase ( ) , int ) : val_ins = [ 0. ] # Prepare input arrays and training function. if self . uses_learning_phase and not isinstance ( K . learning_phase ( ) , int ) : ins = x + y + sample_weights + [ 1. ] else : ins = x + y + sample_weights self . _make_train_function ( ) f = self . train_function # Prepare display labels. out_labels = self . _get_deduped_metrics_names ( ) if do_validation : self . _make_test_function ( ) val_f = self . test_function callback_metrics = copy . copy ( out_labels ) + [ 'val_' + n for n in out_labels ] else : val_f = None callback_metrics = copy . copy ( out_labels ) # Delegate logic to `_fit_loop`. return self . _fit_loop ( f , ins , out_labels = out_labels , batch_size = batch_size , epochs = epochs , verbose = verbose , callbacks = callbacks , val_f = val_f , val_ins = val_ins , shuffle = shuffle , callback_metrics = callback_metrics , initial_epoch = initial_epoch , steps_per_epoch = steps_per_epoch , validation_steps = validation_steps )