ClassificationPartitionedModel
Cross-validated classification model
Description
ClassificationPartitionedModel
is a set of
classification models trained on cross-validated 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 in-fold observations to predict the response for out-of-fold 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.
Creation
Description
Alternatively:
CVDiscrMdl = fitcdiscr(X,Y,Name,Value)
CVKNNMdl = fitcknn(X,Y,Name,Value)
CVNetMdl = fitcnet(X,Y,Name,Value)
CVNBMdl = fitcnb(X,Y,Name,Value)
CVSVMMdl = fitcsvm(X,Y,Name,Value)
CVTreeMdl = fitctree(X,Y,Name,Value)
create a cross-validated model when Name
is either
'CrossVal'
, 'KFold'
,
'Holdout'
, 'Leaveout'
, or
'CVPartition'
. For syntax details, see fitcdiscr
, fitcknn
, fitcnet
, fitcnb
, fitcsvm
, and fitctree
.
Input Arguments
Properties
Object Functions
gather | Gather properties of Statistics and Machine Learning Toolbox object from GPU |
kfoldEdge | Classification edge for cross-validated classification model |
kfoldLoss | Classification loss for cross-validated classification model |
kfoldMargin | Classification margins for cross-validated classification model |
kfoldPredict | Classify observations in cross-validated classification model |
kfoldfun | Cross-validate function for classification |
Examples
Tips
To estimate posterior probabilities of trained, cross-validated SVM classifiers, use
fitSVMPosterior
.