fit_LSTM: Fit LSTM model

View source: R/deepRNN.r

fit_LSTMR Documentation

Fit LSTM model

Description

fit_LSTM is a wrapper function for fitting a LSTM model.

Usage

fit_LSTM(
  model,
  x,
  y,
  timesteps = 1L,
  batch_size = 1,
  epochs = 10,
  verbose = 1,
  validation_split = 0,
  cross_validation = NULL
)

Arguments

model

A model object to train, e.g. returned by build_LSTM.

x

A feature data set, usually a matrix or data frame, returned by get_LSTM_XY.

y

An outcome data set, usually a vector, matrix or data frame, returned by get_LSTM_XY.

timesteps

A vector of timesteps for x and y. A feature does always have at least one timestep, but an outcome is either a scalar with one implicit timestep or a sequence with at least two timesteps. If only one value for timesteps is given, this value is used for the resampled feature tensor produced by as_LSTM_X. If two values are given, the first value is used as before and the second value for the resampled sequence or multi-step outcome tensor produced by as_LSTM_Y.

batch_size

Batch size, the number of samples per gradient update within training process.

epochs

Number of epochs to train the model.

verbose

Verbosity mode (0 = silent, 1 = progress bar, 2 = one line per epoch) determines how the training progress is visualized.

validation_split

Float between 0 and 1. Fraction of the training data used as validation data.

cross_validation

List or NULL (default). The list contains two elements whereby the first element stands for the number of folds (k) and the second element indicates the type min or max for quality measuring.

Value

A trained model object.

See Also

build_LSTM, get_LSTM_XY, fit.keras.engine.training.Model, evaluate.keras.engine.training.Model.

Other Recurrent Neural Network (RNN): as_LSTM_X(), as_LSTM_Y(), as_LSTM_data_frame(), as_LSTM_period_outcome(), as_lag(), as_timesteps(), build_LSTM(), get_LSTM_XY(), get_period_shift(), load_weights_ANN(), predict_ANN(), save_weights_ANN(), start_invert_differencing()


stschn/deepANN documentation built on June 25, 2024, 7:27 a.m.