fynance.models.recurrent_neural_network.RecurrentNeuralNetwork

class fynance.models.recurrent_neural_network.RecurrentNeuralNetwork(X, y, drop=None, x_type=None, y_type=None, bias=True, forward_activation=<class 'torch.nn.modules.activation.Softmax'>, hidden_activation=<class 'torch.nn.modules.activation.Tanh'>, hidden_state_size=None)

Neural network with recurrent architecture.

Parameters:
X, y : array-like or int
  • If it’s an array-like, respectively inputs and outputs data.
  • If it’s an integer, respectively dimension of inputs and outputs.
drop : float, optional

Probability of an element to be zeroed.

forward_activation, hidden_activation : torch.nn.Module, optional

Activation functions, default is respectively Softmax and Tanh function.

hidden_state_size : int, optional

Size of hidden states, default is the same size than input.

Attributes:
criterion : torch.nn.modules.loss

A loss function.

optimizer : torch.optim

An optimizer algorithm.

W_h, W_y : torch.nn.Linear

Respectively recurrent and forward wheights.

f_y, f_h : torch.nn.Module

Respectively forward and hidden activation functions.

Methods

__call__(*input, **kwargs)
set_optimizer(criterion, optimizer[, params]) Set the optimizer object.
train_on(X, y, H) Trains the neural network model.
predict(X, H) Predicts outputs of neural network model.
set_data(X, y[, x_type, y_type]) Set data inputs and outputs.