table of Contents
Sequential.fit()
Syntax syntax
fit(x=None, y=None,
batch_size=None,
epochs=1,
verbose=1,
callbacks=None,
validation_split=0.0, validation_data=None,
shuffle=True,
class_weight=None, sample_weight=None,
initial_epoch=0,
steps_per_epoch=None,
validation_steps=None)
Parameter Description
- the X- : Numpy array of training data. If the input layer model is named, you can also pass a dictionary, maps the input layer name to Numpy array. If the feed (e.g. TensorFlow tensor data) data from the local frame tensor, x may be a
None
(default). - Y : Numpy target array (tag) data. If the output layer model is named, you can also pass a dictionary that maps names to the output layer Numpy array. If the frame is fed from a local tensor (e.g. TensorFlow tensor data) of data, y may be a
None
(default). - batch_size : integer or
None
. Every mention of the number of samples updated. If not specified, the default is 32. - epochs : integer. Trainer iterative rounds. A round in whole
x
ory
an iteration over. Please note that withinitial_epoch
together,epochs
is understood to be "the final rounds." The model is not trainedepochs
round, but the firstepochs
round to stop training. - verbose : 0,. 1 or 2. Log display mode. 0 = Quiet mode, the progress bar = 1, 2 = round row.
- the callbacks : A series of
keras.callbacks.Callback
examples. A series of callback function that can be used during training. See the callbacks . - validation_split : float between 0 and 1. Ratio as verification training data set. The separation of part of the model validation data will not be trained, and will assess these validation error in the data model and any other indicators at the end of each round. Before shuffling verification data
x
andy
the last part of the sample data. - validation_data : tuple
(x_val,y_val)
or tuple(x_val,y_val,val_sample_weights)
, to assess the damage, as well as any model metrics at the end of each round. Model will not be trained on this data. This parameter overridesvalidation_split
. - shuffle : Boolean value (whether or not the data shuffled before each iteration) or a character string (
batch
).batch
HDF5 data handling special options are limited, it inside a batch data shuffling. Whensteps_per_epoch
non-None
time, this parameter is invalid. - class_weight : optional dictionary, used to map the class index (an integer) to the weight (floating point), for a loss weighting function (only during the training). This may help tell the model "pay more attention" from the sample underrepresented classes.
- sample_weight : Optional Numpy heavy weight training sample array for weight loss function (only during the training). You can pass the same input samples flat length (1D) Numpy array (between the sample and the weight of the 1: 1 mapping), or in the case of sequential data, transmission can be size
(samples, sequence_length)
2D array, in order for each sample each time step of applying different weights. In this case, you should ensure thatcompile()
specified insample_weight_mode="temporal"
. - initial_epoch : round (before training help restore) start training.
- steps_per_epoch : a complete round and start the next statement in the total number of (sample batch) prior to step a round. Use TensorFlow data input tensor tensor training, the default value is
None
equal to the number of sample data set divided by the batch size, if not determine, compared with 1. - validation_steps : only specified
steps_per_epoch
when helpful. To verify before stopping the total number of steps (batch samples).
return
A History
object. Which History.history
property loss and training epoch is a continuous evaluation value, and a verification evaluation value of the recording current and the loss (if applicable).
abnormal
- RuntimeError : If the model has never been compiled.
- A ValueError : In case of a mismatch with the model of a desired input data provided.
reference
[Official document] https://keras.io/zh/models/sequential/