Back to models
Regressor

SimpleRNNRegressor

Simple recurrent neural network.

Quickstart

python
from sktime.regression.deep_learning.rnn import SimpleRNNRegressor

estimator = SimpleRNNRegressor(n_epochs=100, batch_size=1, units=6, callbacks=None, add_default_callback=True, random_state=0, verbose=False, loss='mean_squared_error', metrics=None, activation='linear', activation_hidden='tanh', use_bias=True, optimizer=None, dropout=0.0)

Parameters(14)

n_epochsint, default = 100
the number of epochs to train the model
batch_sizeint, default = 1
the number of samples per gradient update.
unitsint, default = 6
number of units in the network
callbackslist of tf.keras.callbacks.Callback objects, default = None
add_default_callbackbool, default = True
whether to add default callback
random_stateint or None, default=0
Seed for random number generation.
verboseboolean, default = False
whether to output extra information
lossstring, default=”mean_squared_error”
fit parameter for the keras model
metricslist of strings, default=[“accuracy”]
metrics to use in fitting the neural network
activationstring or a tf callable, default=”linear”

Activation function used in the output layer. List of available activation functions: https://keras.io/api/layers/activations/

activation_hiddenstring or a tf callable, default=”tanh”

Activation function used in the hidden layers. List of available activation functions: https://keras.io/api/layers/activations/

use_biasboolean, default = True
whether the layer uses a bias vector.
optimizerkeras.optimizers object, default = RMSprop(lr=0.001)
specify the optimizer and the learning rate to be used.
dropoutfloat, default = 0.0
The dropout rate for the RNN layer.

Examples

>>> from sktime.regression.deep_learning.rnn import SimpleRNNRegressor
>>> from sktime.datasets import load_unit_test
>>> X_train, Y_train = load_unit_test (split = "train")
>>> clf = SimpleRNNRegressor (n_epochs = 20, batch_size = 4)
>>> clf. fit (X_train, Y_train) SimpleRNNRegressor(
... )

References

  1. ..[1] benchmark forecaster in M4 forecasting competition: https://github.com/Mcompetitions/M4-methods