Classifier
SimpleRNNClassifier
Simple recurrent neural network.
For a drop-in replacement based on PyTorch, see SimpleRNNClassifierTorch.
Schnellstart
python
from sktime.classification.deep_learning.rnn import SimpleRNNClassifier
estimator = SimpleRNNClassifier(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='sigmoid', activation_hidden='tanh', use_bias=True, optimizer=None, dropout=0.0)Parameter(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
- callbackstuple 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=”sigmoid”
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.
Beispiele
>>> from sktime.classification.deep_learning.rnn import SimpleRNNClassifier
>>> from sktime.datasets import load_unit_test
>>> X_train, y_train = load_unit_test (split = "train")
>>> clf = SimpleRNNClassifier (n_epochs = 20, batch_size = 20)
>>> clf. fit (X_train, y_train) ResNetClassifier(
... )Referenzen
..[1] benchmark forecaster in M4 forecasting competition: https://github.com/Mcompetitions/M4-methods