CompactClassificationGAM
statistics: CompactClassificationGAM
Compact generalized additive model classification
The CompactClassificationGAM class is a compact version of a
Generalized Additive Model classifier, ClassificationGAM. It does
not include the training data, resulting in a smaller classifier size that
can be used for making predictions from new data, but not for tasks such as
cross validation.
A CompactClassificationGAM object can only be created from a
ClassificationGAM model by using the compact method.
See also: ClassificationGAM, fitcgam
Source Code: CompactClassificationGAM
A positive integer value specifying the number of predictors in the training dataset used for training the ClassificationGAM 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:
A 2-element 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. This property is read-only.
A square matrix specifying the cost of misclassification of a point.
Cost(i,j) is the cost of classifying a point into class j
if its true class is i (that is, the rows correspond to the true
class and the columns correspond to the predicted class). The order of
the rows and columns in Cost corresponds to the order of the
classes in ClassNames. The number of rows and columns in
Cost is the number of unique classes in the response. By
default, Cost(i,j) = 1 if i != j, and
Cost(i,j) = 0 if i = j. In other words, the cost is 0
for correct classification and 1 for incorrect classification.
Add or change the Cost property using dot notation as in:
obj.Cost = costMatrix
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 character vector specifying the model formula in the form
"Y ~ terms" where Y represents the response variable and
terms specifies the predictor variables and interaction terms.
This property is read-only.
A logical matrix, positive integer scalar, or character vector
"all" specifying the interaction terms between predictor
variables. This property is read-only.
A scalar or row vector specifying the number of knots for each predictor variable in the spline fitting. This property is read-only.
A scalar or row vector specifying the order of the spline for each predictor variable. This property is read-only.
A scalar or row vector specifying the degrees of freedom for each predictor variable in the spline fitting. This property is read-only.
A scalar value between 0 and 1 specifying the learning rate used in the gradient boosting algorithm. This property is read-only.
A positive integer specifying the maximum number of iterations for the gradient boosting algorithm. This property is read-only.
A structure containing the parameters of the base model without any interaction terms. The base model represents the generalized additive model with only the main effects (predictor terms) included. This property is read-only.
A structure containing the parameters of the model that includes interaction terms. This model extends the base model by adding interaction terms between predictors. This property is read-only.
A logical matrix or matrix of column indices describing the interaction terms applied to the predictor data. This property is read-only.
CompactClassificationGAM: label = predict (obj, XC)
CompactClassificationGAM: [label, score] = predict (obj, XC)
CompactClassificationGAM: [label, score] = predict (…, 'IncludeInteractions', includeInteractions)
label = predict (obj, XC) returns the predicted
labels for the data in XC based on the model stored in the
CompactClassificationGAM object, obj.
[label, score] = predict (obj, XC) also
returns score, which contains the predicted class scores or
posterior probabilities for each observation.
[label, score] = predict (obj, XC,
'IncludeInteractions', includeInteractions) allows you to specify
whether interaction terms should be included when making predictions.
CompactClassificationGAM class object.
See also: CompactClassificationGAM, ClassificationGAM, fitcgam
CompactClassificationGAM: savemodel (obj, filename)
savemodel (obj, filename) saves each property of a
CompactClassificationGAM 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, fitcgam, ClassificationGAM, CompactClassificationGAM
# and compare their size load fisheriris X = meas; Y = species; Mdl = fitcdiscr (X, Y, 'ClassNames', unique (species)) CMdl = crossval (Mdl) |
Mdl =
ClassificationDiscriminant
ResponseName: 'Y'
ClassNames: {'setosa' 'versicolor' 'virginica'}
ScoreTransform: 'none'
NumObservations: 150
NumPredictors: 4
DiscrimType: 'linear'
Mu: [3x4 double]
Coeffs: [4x4 struct]
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: [0, 1, 1; 1, 0, 1; 1, 1, 0]
CrossValidatedModel: 'ClassificationDiscriminant'
KFold: 10
ModelParameters: [1x1 struct]
NumObservations: 150
Partition: [1x1 cvpartition]
PredictorNames: [1x4 cell]
Prior: [0.3333; 0.3333; 0.3333]
ResponseName: 'Y'
ScoreTransform: [1x1 function_handle]
Standardize: []
Trained: [10x1 cell]
|