Choose subset of multiclass ECOC models composed of binary
ClassificationLinear
learners
returns a subset of trained error-correcting output codes (ECOC) models composed of
SubMdl
= selectModels(Mdl
,idx
)ClassificationLinear
binary models from a set of multiclass
ECOC models (Mdl
) trained using various regularization
strengths. The indices (idx
) correspond to the regularization
strengths in Mdl.BinaryLearners{1}.Lambda
and specify which
models to return.
SubMdl
is returned as a CompactClassificationECOC
model object.
One way to build several predictive ECOC models composed of binary linear classification models is:
Create a linear classification model template using
templateLinear
and specify a grid of
regularization strengths using the '
Lambda
'
name-value pair
argument.
Hold out a portion of the data for testing.
Train an ECOC model using fitcecoc
. Specify the
template using the '
Learners
'
name-value pair
argument and supply the training data. fitcecoc
returns one CompactClassificationECOC
model object containing ClassificationLinear
binary learners, but all binary learners contain a model for each
regularization strength.
To determine the quality of each regularized model, pass the
returned model object and the held-out data to, for example,
loss
.
Identify the indices (idx
) of a satisfactory
subset of regularized models, and then pass the returned model and
the indices to selectModels
. The function
selectModels
returns one CompactClassificationECOC
model object,
but it contains numel(idx)
regularized
models.
To predict class labels for new data, pass the data and the subset
of regularized models to predict
.
ClassificationLinear
| CompactClassificationECOC
| fitcecoc
| loss
| predict
| templateLinear