Crossvalidated classification ensemble
ClassificationPartitionedEnsemble
is a set
of classification ensembles trained on crossvalidated folds. Estimate
the quality of classification by cross validation using one or more
"kfold" methods: kfoldPredict
, kfoldLoss
, kfoldMargin
, kfoldEdge
,
and kfoldfun
.
Every "kfold" method uses models trained on infold
observations to predict response for outoffold observations. For
example, suppose you cross validate using five folds. In this case,
every training fold contains roughly 4/5 of the data and every test
fold contains roughly 1/5 of the data. The first model stored in Trained{1}
was
trained on X
and Y
with the
first 1/5 excluded, the second model stored in Trained{2}
was
trained on X
and Y
with the
second 1/5 excluded, and so on. When you call kfoldPredict
, it computes predictions for
the first 1/5 of the data using the first model, for the second 1/5
of data using the second model, and so on. In short, response for
every observation is computed by kfoldPredict
using the model trained without
this observation.
cvens = crossval(ens)
creates
a crossvalidated ensemble from ens
, a classification
ensemble. For syntax details, see the crossval
method
reference page.
cvens = fitensemble(X,Y,method,nlearn,learners,name,value)
creates
a crossvalidated ensemble when name
is one of 'CrossVal'
, 'KFold'
, 'Holdout'
, 'Leaveout'
,
or 'CVPartition'
. For syntax details, see the fitensemble
function reference page.

List of categorical predictors. 

List of the elements in 

Cell array of combiners across all folds. 

Square matrix, where 

Name of the crossvalidated model, a character vector. 

Number of folds used in a crossvalidated ensemble, a positive integer. 

Object holding parameters of 

Number of data points used in training the ensemble, a positive integer. 

Number of data points used in training each fold of the ensemble, a positive integer. 

Partition of class 

Cell array of names for the predictor variables, in the order
in which they appear in 

Numeric vector of prior probabilities for each class. The order
of the elements of 

Name of the response variable 

Function handle for transforming scores, or character vector
representing a builtin transformation function. Add or change a ens.ScoreTransform = 'function' or ens.ScoreTransform = @function 

Cell array of ensembles trained on crossvalidation folds. Every ensemble is full, meaning it contains its training data and weights. 

Cell array of compact ensembles trained on crossvalidation folds. 

Scaled 

A matrix of predictor values. Each column of 

A numeric column vector with the same number of rows as 
kfoldEdge  Classification edge for observations not used for training 
kfoldLoss  Classification loss for observations not used for training 
resume  Resume training learners on crossvalidation folds 
kfoldEdge  Classification edge for observations not used for training 
kfoldfun  Cross validate function 
kfoldLoss  Classification loss for observations not used for training 
kfoldMargin  Classification margins for observations not used for training 
kfoldPredict  Predict response for observations not used for training 
Value. To learn how value classes affect copy operations, see Copying Objects in the MATLAB^{®} documentation.
Evaluate the kfold crossvalidation error for a classification ensemble that models the Fisher iris data:
load fisheriris ens = fitensemble(meas,species,'AdaBoostM2',100,'Tree'); cvens = crossval(ens); L = kfoldLoss(cvens) L = 0.0533