CompactClassificationDiscriminant
statistics: CompactClassificationDiscriminant
A CompactClassificationDiscriminant object is a compact version of a
discriminant analysis model, ClassificationDiscriminant.
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 ClassificationDiscriminant model by using
the compact object method.
The available methods for a CompactClassificationDiscriminant object
are:
predict
loss
margin
savemodel
See also: fitcdiscr, compact, ClassificationDiscriminant
Source Code: CompactClassificationDiscriminant
CompactClassificationDiscriminant.NumPredictors is not documented.
CompactClassificationDiscriminant.PredictorNames is not documented.
CompactClassificationDiscriminant.ResponseName is not documented.
CompactClassificationDiscriminant.ClassNames is not documented.
CompactClassificationDiscriminant.Prior is not documented.
CompactClassificationDiscriminant.Cost is not documented.
CompactClassificationDiscriminant.ScoreTransform is not documented.
CompactClassificationDiscriminant.Sigma is not documented.
CompactClassificationDiscriminant.Mu is not documented.
CompactClassificationDiscriminant.Coeffs is not documented.
CompactClassificationDiscriminant.Delta is not documented.
CompactClassificationDiscriminant.DiscrimType is not documented.
CompactClassificationDiscriminant.Gamma is not documented.
CompactClassificationDiscriminant.MinGamma is not documented.
CompactClassificationDiscriminant.LogDetSigma is not documented.
CompactClassificationDiscriminant: label = predict (obj, XC)
CompactClassificationDiscriminant: [label, score, cost] = predict (obj, XC)
label = predict (obj, XC) returns the vector of
labels predicted for the corresponding instances in XC, using the
corresponding labels from the trained ClassificationDiscriminant,
model, obj.
CompactClassificationDiscriminant class object.
[label, score, cost] = predict (obj,
XC) also returns score, which contains the predicted class
scores or posterior probabilities for each instance of the corresponding
unique classes, and cost, which is a matrix containing the expected
cost of the classifications.
The score matrix contains the posterior probabilities for each class, calculated using the multivariate normal probability density function and the prior probabilities of each class. These scores are normalized to ensure they sum to 1 for each observation.
The cost matrix contains the expected classification cost for each class, computed based on the posterior probabilities and the specified misclassification costs.
See also: CompactClassificationDiscriminant, fitcdiscr
CompactClassificationDiscriminant: L = loss (obj, X, Y)
CompactClassificationDiscriminant: L = loss (…, name, value)
L = loss (obj, X, Y) computes the loss,
L, using the default loss function 'mincost'.
obj is a CompactClassificationDiscriminant object trained on
X and Y.
X must be a numeric matrix of input 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 must have same
numbers of Rows as X.
L = loss (…, name, value) allows
additional options specified by name-value pairs:
| Name | Value | |
|---|---|---|
"LossFun" | Specifies the loss function to use.
Can be a function handle with four input arguments (C, S, W, Cost)
which returns a scalar value or one of:
’binodeviance’, ’classifcost’, ’classiferror’, ’exponential’,
’hinge’, ’logit’,’mincost’, ’quadratic’.
| |
"Weights" | Specifies observation weights, must be
a numeric vector of length equal to the number of rows in X.
Default is ones (size (X, 1)). loss normalizes the weights so that
observation weights in each class sum to the prior probability of that
class. When you supply Weights, loss computes the weighted
classification loss. |
See also: CompactClassificationDiscriminant
CompactClassificationDiscriminant: m = margin (obj, X, Y)
obj is a CompactClassificationDiscriminant object trained on X
and Y.
X must be a numeric matrix of input 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 must have same
numbers of Rows as X.
The classification margin for each observation is the difference between the classification score for the true class and the maximal classification score for the false classes.
See also: fitcdiscr, CompactClassificationDiscriminant
CompactClassificationDiscriminant: savemodel (obj, filename)
savemodel (obj, filename) saves each property of a
CompactClassificationDiscriminant 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, fitcdiscr, ClassificationDiscriminant
# 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: 'none'
Standardize: []
Trained: [10x1 cell]
|