crossval
Cross-validate ensemble
Syntax
cvens = crossval(ens)
cvens = crossval(ens,Name,Value)
Description
creates a cross-validated ensemble fromcvens
= crossval(ens
)ens
, a classification ensemble. Default is 10-fold cross validation.
creates a cross-validated ensemble with additional options specified by one or morecvens
= crossval(ens
,Name,Value
)Name,Value
pair arguments. You can specify several name-value pair arguments in any order asName1,Value1,…,NameN,ValueN
。
Input Arguments
|
A classification ensemble created with |
Name-Value Arguments
Specify optional pairs of arguments asName1=Value1,...,NameN=ValueN
, whereName
is the argument name andValue
is the corresponding value. Name-value arguments must appear after other arguments, but the order of the pairs does not matter.
Before R2021a, use commas to separate each name and value, and encloseName
in quotes.
|
A partition of class Use no more than one of the name-value pairs |
|
Holdout validation tests the specified fraction of the data, and uses the rest of the data for training. Specify a numeric scalar from |
|
Number of folds for cross validation, a numeric positive scalar greater than 1. Use no more than one of the name-value pairs |
|
If Use no more than one of the name-value pairs |
|
Printout frequency, a positive integer scalar. Use this parameter to observe the training of cross-validation folds. Default: |
Output Arguments
|
A cross-validated classification ensemble of class |
Examples
Alternatives
You can create a cross-validation ensemble directly from the data, instead of creating an ensemble followed by a cross-validation ensemble. To do so, include one of these five options infitcensemble
:'crossval'
,'kfold'
,'holdout'
,'leaveout'
, or'cvpartition'
。