Description Usage Arguments Value See Also
Trains the model for a fixed number of epochs (iterations on a dataset).
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 | ## S3 method for class 'keras.engine.training.Model'
fit(
object,
x = NULL,
y = NULL,
batch_size = NULL,
epochs = 10,
verbose = getOption("keras.fit_verbose", default = 1),
callbacks = NULL,
view_metrics = getOption("keras.view_metrics", default = "auto"),
validation_split = 0,
validation_data = NULL,
shuffle = TRUE,
class_weight = NULL,
sample_weight = NULL,
initial_epoch = 0,
steps_per_epoch = NULL,
validation_steps = NULL,
...
)
|
object |
Model to train. |
x |
Vector, matrix, or array of training data (or list if the model has
multiple inputs). If all inputs in the model are named, you can also pass a
list mapping input names to data. |
y |
Vector, matrix, or array of target (label) data (or list if the model has
multiple outputs). If all outputs in the model are named, you can also pass
a list mapping output names to data. |
batch_size |
Integer or |
epochs |
Number of epochs to train the model.
Note that in conjunction with |
verbose |
Verbosity mode (0 = silent, 1 = progress bar, 2 = one line per epoch). |
callbacks |
List of callbacks to be called during training. |
view_metrics |
View realtime plot of training metrics (by epoch). The
default ( |
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. The validation data
is selected from the last samples in the |
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 list (x_val, y_val) or a list (x_val, y_val,
val_sample_weights). |
shuffle |
shuffle: Logical (whether to shuffle the training data
before each epoch) or string (for "batch"). "batch" is a special option
for dealing with the limitations of HDF5 data; it shuffles in batch-sized
chunks. Has no effect when |
class_weight |
Optional named list mapping indices (integers) to a weight (float) value, used for weighting the loss function (during training only). 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
|
initial_epoch |
Integer, 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 |
validation_steps |
Only relevant if |
... |
Unused |
A history
object that contains all information collected
during training.
Other model functions:
compile.keras.engine.training.Model()
,
evaluate.keras.engine.training.Model()
,
evaluate_generator()
,
fit_generator()
,
get_config()
,
get_layer()
,
keras_model_sequential()
,
keras_model()
,
multi_gpu_model()
,
pop_layer()
,
predict.keras.engine.training.Model()
,
predict_generator()
,
predict_on_batch()
,
predict_proba()
,
summary.keras.engine.training.Model()
,
train_on_batch()
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.