pub struct MLP { /* private fields */ }Expand description
A multilayer perceptron.
A multilayer perceptron is a collection of Layers. It calculates the output of each layer
and passes it to the next layer.
The output of the MLP is the output of the last layer.
Implementations§
Source§impl MLP
impl MLP
Sourcepub fn new(
n_inputs: u32,
input_activation: Activation,
n_hidden: Vec<u32>,
hidden_activation: Activation,
n_outputs: u32,
output_activation: Activation,
) -> MLP
pub fn new( n_inputs: u32, input_activation: Activation, n_hidden: Vec<u32>, hidden_activation: Activation, n_outputs: u32, output_activation: Activation, ) -> MLP
Create a new multilayer perceptron (MLP) with the given number of inputs, hidden layers, and outputs.
The MLP is a collection of Layers. The total number of layers is n_hidden.len() + 2.
The first layer has n_inputs inputs and n_hidden[0] neurons.
The hidden layer i has n_hidden[i] neurons. There are n_hidden.len() hidden layers.
The last layer has n_hidden[n_hidden.len() - 1] inputs and n_outputs neurons.
The activation functions for the input, hidden, and output layers are input_activation, hidden_activation, and output_activation, respectively.