Crossvalidated classification model
ClassificationPartitionedModel
is a set of
classification models 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 the response for outoffold observations. For example, suppose you cross validate using five folds. In this case, the software randomly assigns each observation into five roughly equally sized groups. The training fold contains four of the groups (i.e., roughly 4/5 of the data) and the test fold contains the other group (i.e., roughly 1/5 of the data). In this case, cross validation proceeds as follows:
The software trains the first model (stored in CVMdl.Trained{1}
)
using the observations in the last four groups and reserves the observations
in the first group for validation.
The software trains the second model (stored in CVMdl.Trained{2}
)
using the observations in the first group and last three groups, and
reserves the observations in the second group for validation.
The software proceeds in a similar fashion for the third to fifth models.
If you validate by calling kfoldPredict
, it computes predictions for
the observations in group 1 using the first model, group 2 for the
second model, and so on. In short, the software estimates a response
for every observation using the model trained without that observation.
creates a crossvalidated
classification model from a classification model (CVMdl
=
crossval(Mdl
)Mdl
).
Alternatively:
CVDiscrMdl = fitcdiscr(X,Y,Name,Value)
CVEnsMdl = fitensemble(X,Y,Name,Value)
CVKNNMdl = fitcknn(X,Y,Name,Value)
CVNBMdl = fitcnb(X,Y,Name,Value)
CVSVMMdl = fitcsvm(X,Y,Name,Value)
CVTreeMdl = fitctree(X,Y,Name,Value)
create a crossvalidated model when name
is
either 'CrossVal'
, 'KFold'
, 'Holdout'
, 'Leaveout'
,
or 'CVPartition'
. For syntax details, see fitcdiscr
, fitensemble
, fitcknn
, fitcnb
, fitcsvm
, and fitctree
.
For a crossvalidated, errorcorrecting output code multiclass
model, see ClassificationPartitionedECOC
and fitcecoc
.

A classification model.


List of categorical predictors. If If  

List of elements in  

Square matrix, where If CVModel.Cost = CostMatrix;  

Name of the crossvalidated model, which is a string.  

Number of folds used in crossvalidated model, which is a positive integer.  

Object holding parameters of  

The partition of class  

Cell array of strings containing the predictor names, in the
order that they appear in  

Numeric vector of prior probabilities for each class. The order
of the elements of If CVModel.Prior = priorVector;  

String describing the response variable  

String representing a builtin transformation function, or a function handle for transforming predicted classification scores. To change the score transformation function to, e.g.,
 

The trained learners, which is a cell array of compact classification models.  

The scaled  

Numeric matrix of predictor values. Each column of  

Categorical or character array, logical or numeric vector, or
cell array of strings specifying the class labels for each observation. 
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.
To estimate posterior probabilities of trained, crossvalidated
SVM classifiers, use fitSVMPosterior
.
ClassificationDiscriminant
 ClassificationECOC
 ClassificationEnsemble
 ClassificationKNN
 ClassificationNaiveBayes
 ClassificationPartitionedEnsemble
 ClassificationSVM
 ClassificationTree
 CompactClassificationDiscriminant
 CompactClassificationEnsemble
 CompactClassificationNaiveBayes
 CompactClassificationSVM
 CompactClassificationTree
 fitcdiscr
 fitcecoc
 fitcknn
 fitcnb
 fitcsvm
 fitctree
 fitensemble
 fitSVMPosterior
 RegressionPartitionedModel