ClassificationECOC
statistics: ClassificationECOC
A multiclass model built from binary learners.
An error correcting output codes model turns a problem of K classes into a set of two class problems. A coding matrix gives one column per binary learner saying which classes that learner calls +1, which it calls -1, and which sit it out; a new observation is sent to every learner and given the class whose column of the matrix its scores match most closely.
The fit is carried out by the learners themselves, whichever
fitcecoc was asked for, and the decoding by
CompactClassificationECOC, which this class holds the data of a fit
on top of.
See also: fitcecoc, CompactClassificationECOC, designecoc
Source Code: ClassificationECOC
The ClassificationECOC class contains the following properties:
Where the model was fitted from a table, the predictors are the coded matrix and not the table: a variable holding levels is stored as its level codes, and the coding is kept with the model.
This property is read-only.
An NxL matrix of -1, 0 and +1, row n being the row of
CodingMatrix belonging to that observation’s class. This
property is read-only.
The ClassificationECOC class offers the following public methods:
ClassificationECOC: obj = ClassificationECOC (X, Y)
ClassificationECOC: obj = ClassificationECOC (Tbl, ResponseVarName)
ClassificationECOC: obj = ClassificationECOC (Tbl, formula)
ClassificationECOC: obj = ClassificationECOC (Tbl, Y)
ClassificationECOC: obj = ClassificationECOC (…, name, value)
obj = ClassificationECOC (X, Y) fits one
binary learner per column of a one against one coding design and
returns them as a ClassificationECOC object. fitcecoc is
the documented way in, and its help lists the options both take.
See also: fitcecoc, CompactClassificationECOC, designecoc
ClassificationECOC: CVMdl = crossval (obj)
ClassificationECOC: CVMdl = crossval (…, name, value)
CVMdl = crossval (obj) partitions the training data
into ten folds, fits the same model to each fold’s training part, and
returns them as a ClassificationPartitionedECOC.
| Name | Value | |
|---|---|---|
'KFold' | The number of folds, an integer greater than one. The default is ten, or the number of observations when there are fewer than ten. | |
'Holdout' | The share of the data held out, a number strictly between 0 and 1. | |
'Leaveout' | 'on' for one fold per
observation, 'off' otherwise. | |
'CVPartition' | A cvpartition object,
which names the folds outright. |
Only one of the four may be given.
See also: ClassificationECOC, ClassificationPartitionedECOC, cvpartition
ClassificationECOC: CMdl = compact (obj)
CMdl = compact (obj) returns a
CompactClassificationECOC carrying the binary learners and the
coding matrix but not X, Y or W, so it predicts
and scores new data but cannot be refitted or cross validated.
See also: ClassificationECOC, CompactClassificationECOC
ClassificationECOC: label = predict (obj, XC)
ClassificationECOC: [label, NegLoss, PBScore] = predict (…)
ClassificationECOC: […] = predict (…, name, value)
It takes and returns exactly what
CompactClassificationECOC.predict does, the training data
playing no part in a prediction.
The new data may be a table, whose variables are matched to the predictors the model was fitted on by name and not by position: one the model was not fitted on is passed over, one it needs and cannot find is named, and a value holding a level is coded as that level was coded at fitting.
See also: ClassificationECOC, CompactClassificationECOC.predict
ClassificationECOC: obj = discardSupportVectors (obj)
obj = discardSupportVectors (obj) empties
Alpha, SupportVectors and SupportVectorLabels on
every binary learner that is a support vector machine on a linear
kernel, whose linear model stands in for them exactly, so nothing the
model answers changes. Any other learner is left as it is, a code
being free to mix them, and a model with no linear support vector
machine among its learners warns and is returned unchanged.
See also: ClassificationECOC, ClassificationSVM.discardSupportVectors
ClassificationECOC: sub = selectModels (obj, idx)
sub = selectModels (obj, idx) narrows every
binary learner to the strengths idx names, which may be indices
into the learner’s Lambda or a logical vector over it. Only a
linear learner is fitted over several strengths, so any other raises.
See also: ClassificationECOC, ClassificationLinear.selectModels
ClassificationECOC: m = margin (obj, X, Y)
ClassificationECOC: m = margin (obj, Tbl, ResponseVarName)
ClassificationECOC: m = margin (obj, Tbl)
X may also be a table Tbl, whose variables are matched to
the predictors the model was fitted on by name and not by position.
margin (obj, Tbl, ResponseVarName) takes the
response from the variable ResponseVarName names, and
margin (obj, Tbl) from the variable the model was
fitted on. The response may also be given beside the table as
Y.
See also: CompactClassificationECOC.margin
ClassificationECOC: e = edge (obj, X, Y)
ClassificationECOC: e = edge (obj, Tbl, ResponseVarName)
ClassificationECOC: e = edge (obj, Tbl)
X may also be a table Tbl, whose variables are matched to
the predictors the model was fitted on by name and not by position.
edge (obj, Tbl, ResponseVarName) takes the
response from the variable ResponseVarName names, and
edge (obj, Tbl) from the variable the model was
fitted on. The response may also be given beside the table as
Y.
See also: CompactClassificationECOC.edge
ClassificationECOC: L = loss (obj, X, Y)
ClassificationECOC: L = loss (obj, Tbl, ResponseVarName)
ClassificationECOC: L = loss (obj, Tbl)
X may also be a table Tbl, whose variables are matched to
the predictors the model was fitted on by name and not by position.
loss (obj, Tbl, ResponseVarName) takes the
response from the variable ResponseVarName names, and
loss (obj, Tbl) from the variable the model was
fitted on. The response may also be given beside the table as
Y.
See also: CompactClassificationECOC.loss