Next topic



class fynance.models.neural_network.MultiLayerPerceptron(X, y, layers=[], activation=None, drop=None, x_type=None, y_type=None, bias=True, activation_kwargs={})

Neural network with MultiLayer Perceptron architecture.

Refered as vanilla neural network model, with n hidden layers s.t n \(\geq\) 1, with each one a specified number of neurons.

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.
layers : list of int

List of number of neurons in each hidden layer.

activation : torch.nn.Module

Activation function of layers.

drop : float, optional

Probability of an element to be zeroed.

See also

BaseNeuralNet, RollMultiLayerPerceptron
criterion : torch.nn.modules.loss

A loss function.

optimizer : torch.optim

An optimizer algorithm.

n : int

Number of hidden layers.

layers : list of int

List with the number of neurons for each hidden layer.

f : torch.nn.Module

Activation function.


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