Cross-validation loss of partitioned regression ensemble
L = kfoldLoss(cvens)
L = kfoldLoss(cvens,Name,Value)
L = kfoldLoss(cvens,Name,Value) returns cross-validation loss with additional options specified by one or more Name,Value pair arguments. You can specify several name-value pair arguments in any order as Name1,Value1,…,NameN,ValueN.
Object of class RegressionPartitionedEnsemble. Create obj with fitensemble along with one of the cross-validation options: 'crossval', 'kfold', 'holdout', 'leaveout', or 'cvpartition'. Alternatively, create obj from a regression ensemble with crossval.
Specify optional comma-separated pairs of Name,Value arguments. Name is the argument name and Value is the corresponding value. Name must appear inside single quotes (' '). You can specify several name and value pair arguments in any order as Name1,Value1,...,NameN,ValueN.
Indices of folds ranging from 1 to cvens.KFold. Use only these folds for predictions.
Function handle for loss function, or the string 'mse', meaning mean squared error. If you pass a function handle fun, loss calls it as
where Y, Yfit, and W are numeric vectors of the same length.
The returned value fun(Y,Yfit,W) should be a scalar.
String representing the meaning of the output L:
The loss (mean squared error) between the observations in a fold when compared against predictions made with an ensemble trained on the out-of-fold data. L can be a vector, and can mean different things, depending on the name-value pair settings.
Find the cross-validation loss for a regression ensemble of the carsmall data:
load carsmall X = [Displacement Horsepower Weight]; rens = fitensemble(X,MPG,'LSboost',100,'Tree'); cvrens = crossval(rens); L = kfoldLoss(cvrens) L = 25.6935