fitcnet
Fit a Neural Network classification model.
Mdl = fitcnet (X, Y)
returns a Neural Network
classification model, Mdl, with X being the predictor data, and
Y the class labels of observations in X.
X
must be a numeric matrix of predictor data where rows
correspond to observations and columns correspond to features or variables.
Y
is matrix or cell matrix containing the class labels of
corresponding predictor data in X. Y can contain any type of
categorical data. Y must have same numbers of rows as X.
Mdl = fitcnet (…, name, value)
returns a
Neural Network classification model with additional options specified by
Name-Value
pair arguments listed below.
Name | Value | |
---|---|---|
"Standardize" | A boolean flag indicating whether the data in X should be standardized prior to training. | |
"PredictorNames" | A cell array of character vectors specifying the predictor variable names. The variable names are assumed to be in the same order as they appear in the training data X. | |
"ResponseName" | A character vector specifying the name of the response variable. | |
"ClassNames" | Names of the classes in the class
labels, Y, used for fitting the Neural Network model.
ClassNames are of the same type as the class labels in Y. | |
"Prior" | A numeric vector specifying the prior
probabilities for each class. The order of the elements in Prior
corresponds to the order of the classes in ClassNames . | |
"LayerSizes" | A vector of positive integers that defines the sizes of the fully connected layers in the neural network model. Each element in LayerSizes corresponds to the number of outputs for the respective fully connected layer in the neural network model. The default value is 10. | |
"LearningRate" | A positive scalar value that defines the learning rate during the gradient descent. Default value is 0.01. | |
"Activations" | A character vector or a cellstr vector
specifying the activation functions for the hidden layers of the neural
network (excluding the output layer). The available activation functions are
'linear' , 'sigmoid' , 'tanh' , 'sigmoid' , and
'none' . The default value is 'sigmoid' . | |
"OutputLayerActivation" | A character vector specifying
the activation function for the output layer of the neural network. The
available activation functions are 'linear' , 'sigmoid' ,
'tanh' , 'sigmoid' , and 'none' . The default value is
'sigmoid' . | |
"IterationLimit" | A positive integer scalar that specifies the maximum number of training iterations. The default value is 1000. | |
"DisplayInfo" | A boolean flag indicating whether to
print information during training. Default is false . | |
"ScoreTransform" | A character vector defining one of
the following functions or a user defined function handle, which is used
for transforming the prediction scores returned by the predict and
resubPredict methods. Default value is 'none' . |
Value | Description | |
---|---|---|
"doublelogit" | ||
"invlogit" | ||
"ismax" | Sets the score for the class with the largest score to 1, and sets the scores for all other classes to 0 | |
"logit" | ||
"none" | (no transformation) | |
"identity" | (no transformation) | |
"sign" | ||
"symmetric" | ||
"symmetricismax" | Sets the score for the class with the largest score to 1, and sets the scores for all other classes to -1 | |
"symmetriclogit" |
See also: ClassificationNeuralNetwork
Source Code: fitcnet
## Train a Neural Network on the Fisher's Iris data set and display ## a confusion chart with the classification results. load fisheriris Mdl = fitcnet (meas, species); pred_species = resubPredict (Mdl); confusionchart (species, pred_species); |