Fit a keras model
Learn the weight and bias values for am model given training data. Model must be compiled first. The model is modified in place.
keras_fit(model, x, y, batch_size = 32, epochs = 10, verbose = 1, callbacks = NULL, validation_split = 0, validation_data = NULL, shuffle = TRUE, class_weight = NULL, sample_weight = NULL, initial_epoch = 0)
model | 
 a keras model object created with Sequential  | 
x | 
 input data as a numeric matrix  | 
y | 
 labels; either a numeric matrix or numeric vector  | 
batch_size | 
 integer. Number of samples per gradient update.  | 
epochs | 
 integer, the number of epochs to train the model.  | 
verbose | 
 0 for no logging to stdout, 1 for progress bar logging, 2 for one log line per epoch.  | 
callbacks | 
 list of 'keras.callbacks.Callback“ instances. List of callbacks to apply during training.  | 
validation_split | 
 float (  | 
validation_data | 
 
  | 
shuffle | 
 boolean or string (for   | 
class_weight | 
 dictionary mapping classes to a weight value, used for scaling the loss function (during training only).  | 
sample_weight | 
 Numpy array of weights for the training samples  | 
initial_epoch | 
 epoch at which to start training  | 
Taylor B. Arnold, taylor.arnold@acm.org
Chollet, Francois. 2015. Keras: Deep Learning library for Theano and TensorFlow.
Other models: LoadSave,
Predict, Sequential,
keras_compile
if(keras_available()) {
  X_train <- matrix(rnorm(100 * 10), nrow = 100)
  Y_train <- to_categorical(matrix(sample(0:2, 100, TRUE), ncol = 1), 3)
  mod <- Sequential()
  mod$add(Dense(units = 50, input_shape = dim(X_train)[2]))
  mod$add(Dropout(rate = 0.5))
  mod$add(Activation("relu"))
  mod$add(Dense(units = 3))
  mod$add(ActivityRegularization(l1 = 1))
  mod$add(Activation("softmax"))
  keras_compile(mod,  loss = 'categorical_crossentropy', optimizer = RMSprop())
  keras_fit(mod, X_train, Y_train, batch_size = 32, epochs = 5,
            verbose = 0, validation_split = 0.2)
}Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.