- statistics: Mdl = fcnntrain (X, Y, @ LayerSizes, Activations, LearningRate, Epochs, @ DisplayInfo)
Train a fully connected Neural Network.
Mdl = fcnntrain (…)
requires the following input arguments.
- X : An matrix containing the data set to be trained upon. Rows correspond to individual samples and columns correspond to features (dimensions). Type of X must be double.
- Y : An column vector containing the labels of the training dataset. The labels must be natural numbers (positive integers) starting from 1 up to the number of classes, similarily as returned by the ‘grp2idx‘ function. Type of Y must be double.
- LayerSizes : A numeric row vector of integer values defining the size of the hidden layers of the network. Input and output layers are automatically determined by the training data and their labels.
- Activations : A numeric row vector of integer values defining the activation functions to be used at each layer including the output layer. The corresponding codes to activation functions is:
-
0
: 'Linear'
-
1
: 'Sigmoid'
-
2
: 'Rectified Linear Unit (ReLU)'
-
3
: 'Hyperbolic tangent (tanh)'
-
4
: 'Softmax'
-
5
: 'Parametric or Leaky ReLU'
-
6
: 'Exponential Linear Unit (ELU)'
-
7
: 'Gaussian Error Linear Unit (GELU)'
- LearningRate : A positive scalar value defining the learning rate used by the gradient descend algorithm during training.
- Epochs : A positive scalar value defining the number of epochs for training the model.
- DisplayInfo : A boolean scalar indicating whether to print information during training.
fcnntrain
returns the trained model, Mdl, as a structure containing the following fields:
-
LayerWeights
: A cell array with each element containing a matrix with the Weights and Biases of each layer including the output layer.
-
Activations
: A numeric row vector of integer values defining the activation functions to be used at each layer including the output layer.
-
Accuracy
: The prediction accuracy at each iteration during the neural network model’s training process.
-
Loss
: The loss value recorded at each iteration during the neural network model’s training process.
See also:
fcnnpredict,
fitcnet,
ClassificationNeuralNetwork
Source Code:
fcnntrain