CompactClassificationNeuralNetwork
statistics: CompactClassificationNeuralNetwork
Compact neural network classification
The CompactClassificationNeuralNetwork class implements a compact
version of the neural network classifier object, which can predict responses
for new data using the predict method, but does not store the training
data.
A compact neural network classification model is a smaller version of the
full ClassificationNeuralNetwork model that does not include the
training data. It consumes less memory than the full model, but cannot
perform tasks that require the training data, such as cross-validation.
Create a CompactClassificationNeuralNetwork object by using the
compact method on a ClassificationNeuralNetwork object.
See also: ClassificationNeuralNetwork, fitcnet
Source Code: CompactClassificationNeuralNetwork
A positive integer value specifying the number of predictors in the training dataset used for training the neural network model. This property is read-only.
A cell array of character vectors specifying the names of the predictor variables. The names are in the order in which the appear in the training dataset. This property is read-only.
A character vector specifying the name of the response variable Y. This property is read-only.
An array of unique values of the response variable Y, which has the
same data types as the data in Y. This property is read-only.
ClassNames can have any of the following datatypes:
Specified as a function handle for transforming the classification
scores. Add or change the ScoreTransform property using dot
notation as in:
obj.ScoreTransform = 'function_name'
obj.ScoreTransform = @function_handle
When specified as a character vector, it can be any of the following
built-in functions. Nevertherless, the ScoreTransform property
always stores their function handle equivalent.
| Value | Description | |
|---|---|---|
"doublelogit" | ||
"invlogit" | ||
"ismax" | Sets the score for the class with the largest score to 1, and 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 for all other classes to -1 | |
"symmetriclogit" |
A boolean flag indicating whether the predictor data has been
standardized prior to training. When true, the predictors are
centered and scaled to have zero mean and unit variance. This property
is read-only.
A numeric vector containing the standard deviations of the predictors
used for standardization. Empty if Standardize is false.
This property is read-only.
A numeric vector containing the means of the predictors used for
standardization. Empty if Standardize is false.
This property is read-only.
A positive integer vector specifying the sizes of the fully connected
layers in the neural network model. The i-th element of
LayerSizes is the number of outputs in the i-th fully connected
layer of the neural network model. LayerSizes does not include
the size of the final fully connected layer. This layer always has K
outputs, where K is the number of classes in Y. This property is
read-only.
A character vector or cell array of character vectors specifying the
activation functions used in the hidden layers of the neural network.
Supported activation functions include: "linear",
"sigmoid", "relu", "tanh", "softmax",
"lrelu", "prelu", "elu", and "gelu".
This property is read-only.
A character vector specifying the activation function of the output layer
of the neural network. Supported activation functions are the same as
for the Activations property. This property is read-only.
A positive scalar value defining the learning rate used by the gradient descent algorithm during training. This property is read-only.
A positive integer value defining the maximum number of epochs for training the model. This property is read-only.
A structure containing the parameters used to train the neural network
classifier model, including layer weights and activations as generated by
the fcnntrain function. This property is read-only.
A structure containing convergence information of the neural network classifier model with the following fields:
Accuracy - The prediction accuracy at each iteration
during training
TrainingLoss - The loss value recorded at each iteration
during training
Time - The cumulative time taken for all iterations in
seconds
This property is read-only.
A boolean flag indicating whether to print information during training. This property is read-only.
A character vector specifying the solver algorithm used to train the
neural network model. Currently only "Gradient Descent" is
supported. This property is read-only.
CompactClassificationNeuralNetwork: label = predict (obj, XC)
CompactClassificationNeuralNetwork: [label, score] = predict (obj, XC)
label = predict (obj, XC) returns the vector of
labels predicted for the corresponding instances in XC, using the
neural network model stored in the CompactClassificationNeuralNetwork
model, obj.
CompactClassificationNeuralNetwork class
object.
[label, score] = predict (obj, XC) also
returns score, which contains the predicted class scores or
posterior probabilities for each instance of the corresponding unique
classes.
The score matrix contains the classification scores for each class.
For each observation in XC, the predicted class label is the one
with the highest score among all classes. If the ScoreTransform
property is set to a transformation function, the scores are transformed
accordingly before being returned.
See also: CompactClassificationNeuralNetwork, ClassificationNeuralNetwork, fitcnet
CompactClassificationNeuralNetwork: savemodel (obj, filename)
savemodel (obj, filename) saves each property of a
CompactClassificationNeuralNetwork object into an Octave binary file, the
name of which is specified in filename, along with an extra
variable, which defines the type classification object these variables
constitute. Use loadmodel in order to load a classification
object into Octave’s workspace.
See also: loadmodel, fitcnet, ClassificationNeuralNetwork
# and compare their size load fisheriris X = meas; Y = species; Mdl = fitcnet (X, Y, 'ClassNames', unique (species)) CMdl = crossval (Mdl) |
Mdl =
ClassificationNeuralNetwork
ResponseName: 'Y'
ClassNames: {'setosa' 'versicolor' 'virginica'}
ScoreTransform: 'none'
NumObservations: 150
NumPredictors: 4
LayerSizes: [10]
Activations: 'sigmoid'
OutputLayerActivation: 'sigmoid'
Solver: 'Gradient Descend'
CMdl =
ClassificationPartitionedModel object with properties:
BinEdges: []
CategoricalPredictors: []
X: [5.1000, 3.5000, 1.4000, 0.2000; 4.9000, 3, 1.4000, 0.2000; 4.7000, 3.2000, ...]
Y: [150x1 cell]
ClassNames: [3x1 cell]
Cost: []
CrossValidatedModel: 'ClassificationNeuralNetwork'
KFold: 10
ModelParameters: [1x1 struct]
NumObservations: 150
Partition: [1x1 cvpartition]
PredictorNames: [1x4 cell]
Prior: []
ResponseName: "Y"
ScoreTransform: [1x1 function_handle]
Standardize: 0
Trained: [10x1 cell]
|