Resume training ensemble
ens1 = resume(ens,nlearn)
ens1 = resume(ens,nlearn,Name,Value)
ens1 = resume(
ens in every fold for
nlearn more cycles.
resume uses the same training options
fitrensemble used to create
ens, except for parallel
training options. If you want to resume training in parallel, pass the
'Options' name-value pair.
A cross-validated regression ensemble.
A positive integer, the number of cycles for additional training of
Specify optional pairs of arguments as
the argument name and
Value 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 enclose
Name in quotes.
Printout frequency, a positive integer scalar or
For fastest training of some boosted decision trees, set
Options for computing in parallel and setting random numbers, specified as a structure. Create
You need Parallel Computing Toolbox™ to compute in parallel.
You can use the same parallel options for
For dual-core systems and above,
The cross-validated regression ensemble
Cross-Validate Regression Ensemble Augmented with Additional Training
Examine the cross-validation error after training a regression ensemble for more cycles.
carsmall data set and select displacement, horsepower, and vehicle weight as predictors.
load carsmall X = [Displacement Horsepower Weight];
Train a regression ensemble for 50 cycles.
ens = fitrensemble(X,MPG,'NumLearningCycles',50);
Cross-validate the ensemble and examine the cross-validation error.
rng(10,'twister') % For reproducibility cvens = crossval(ens); L = kfoldLoss(cvens)
L = 27.9435
Train for 50 more cycles and examine the new cross-validation error.
cvens = resume(cvens,50); L = kfoldLoss(cvens)
L = 28.7114
The additional training did not improve the cross-validation error.
Automatic Parallel Support
Accelerate code by automatically running computation in parallel using Parallel Computing Toolbox™.
resume supports parallel training
'Options' name-value argument. Create options using
statset, such as
options = statset('UseParallel',true).
Parallel ensemble training requires you to set the
'Bag'. Parallel training is available only for tree learners, the
default type for
Accelerate code by running on a graphics processing unit (GPU) using Parallel Computing Toolbox™.
This function fully supports GPU arrays. For more information, see Run MATLAB Functions on a GPU (Parallel Computing Toolbox).