Categories &

Functions List

Class Definition: CompactClassificationNeuralNetwork

statistics: CompactClassificationNeuralNetwork

A CompactClassificationNeuralNetwork object is a compact version of a discriminant analysis model, CompactClassificationNeuralNetwork.

The CompactClassificationDiscriminant does not include the training data resulting to a smaller classifier size, which can be used for making predictions from new data, but not for tasks such as cross validation. It can only be created from a ClassificationNeuralNetwork model by using the compact object method.

The available methods for a CompactClassificationNeuralNetwork object are:

  • predict
  • savemodel

See also: fitcdiscr, ClassificationDiscriminant

Source Code: CompactClassificationNeuralNetwork

Method: predict

CompactClassificationNeuralNetwork: labels = predict (obj, XC)
CompactClassificationNeuralNetwork: [labels, scores] = predict (obj, XC)

Classify new data points into categories using the Neural Network classification object.

labels = predict (obj, XC) returns the vector of labels predicted for the corresponding instances in XC, using the trained neural network classification compact model in obj.

  • obj must be a CompactClassificationNeuralNetwork class object.
  • X must be an M×P numeric matrix with the same number of predictors P as the corresponding predictors of the trained neural network compact model in obj.

[labels, scores] = predict (obj, XC also returns scores, which represent the probability of each label belonging to a specific class. For each observation in X, the predicted class label is the one with the highest score among all classes. Alternatively, scores can contain the posterior probabilities if the ScoreTransform has been previously set.

See also: fitcnet, ClassificationNeuralNetwork, CompactClassificationNeuralNetwork

Method: savemodel

ClassificationNeuralNetwork: savemodel (obj, filename)

Save a ClassificationNeuralNetwork object.

savemodel (obj, filename) saves a ClassificationNeuralNetwork object into a file defined by filename.

See also: loadmodel, fitcnet, ClassificationNeuralNetwork, cvpartition, ClassificationPartitionedModel

Example: 1

 

 ## Create a neural network classifier and its compact version
 # and compare their size

 load fisheriris
 X = meas;
 Y = species;

 Mdl = fitcnet (X, Y, 'ClassNames', unique (species))
 CMdl = crossval (Mdl);

 whos ('Mdl', 'CMdl')

Mdl =

  ClassificationNeuralNetwork object with properties:

                Activations: sigmoid
                 ClassNames: [3x1 cell]
            ConvergenceInfo: [1x1 struct]
                DisplayInfo: 0
             IterationLimit: [1x1 double]
                 LayerSizes: [1x1 double]
               LearningRate: [1x1 double]
            ModelParameters: [1x1 struct]
                         Mu: [0x0 double]
            NumObservations: [1x1 double]
              NumPredictors: [1x1 double]
      OutputLayerActivation: sigmoid
             PredictorNames: [1x4 cell]
               ResponseName: Y
                   RowsUsed: [150x1 double]
             ScoreTransform: none
                      Sigma: [0x0 double]
                     Solver: Gradient Descend
                Standardize: 0
                          X: [150x4 double]
                          Y: [150x1 cell]

Variables visible from the current scope:

variables in scope: build_DEMOS: /home/promitheas/.local/share/octave/api-v59/packages/pkg-octave-doc-0.5.5/build_DEMOS.m

  Attr   Name        Size                     Bytes  Class
  ====   ====        ====                     =====  ===== 
         Mdl         1x1                          0  ClassificationNeuralNetwork
         CMdl        1x1                          0  ClassificationPartitionedModel

Total is 2 elements using 0 bytes