Main Content


Resume training ensemble


ens1 = resume(ens,nlearn)
ens1 = resume(ens,nlearn,Name,Value)


ens1 = resume(ens,nlearn) trains ens 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.

ens1 = resume(ens,nlearn,Name,Value) trains ens with additional options specified by one or more Name,Value pair arguments.

Input Arguments


A regression ensemble, created with fitrensemble.


A positive integer, the number of cycles for additional training of ens.

Name-Value Arguments

Specify optional pairs of arguments as Name1=Value1,...,NameN=ValueN, where Name is 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 'off' (no printouts). When NPrint is a positive integer, displays a message to the command line after training NPrint weak learners.


For fastest training of some boosted decision trees, set NPrint to the default value 'off'. This tip holds when the classification Method is 'AdaBoostM1', 'AdaBoostM2', 'GentleBoost', or 'LogitBoost', or when the regression Method is 'LSBoost'.

Default: 'off'


Options for computing in parallel and setting random numbers, specified as a structure. Create the Options structure with statset.


You need Parallel Computing Toolbox™ to compute in parallel.

You can use the same parallel options for resume as you used for the original training. However, you can change the parallel options as needed. This table lists the option fields and their values.

Field NameValueDefault

Set this value to true to compute in parallel. Parallel ensemble training requires you to set the 'Method' name-value argument to 'Bag'. Parallel training is available only for tree learners, the default type for 'Bag'.


Set this value to true to run computations in parallel in a reproducible manner.

To compute reproducibly, set Streams to a type that allows substreams: 'mlfg6331_64' or 'mrg32k3a'.

StreamsSpecify this value as a RandStream object or cell array of such objects. Use a single object except when the UseParallel value is true and the UseSubstreams value is false. In that case, use a cell array that has the same size as the parallel pool.If you do not specify Streams, then resume uses the default stream or streams.

For dual-core systems and above, resume parallelizes training using Intel® Threading Building Blocks (TBB). Therefore, specifying the UseParallel option as true might not provide a significant speedup on a single computer. For details on Intel TBB, see

Example: 'Options',statset('UseParallel',true)

Output Arguments


The regression ensemble ens, augmented with additional training.


expand all

Train a regression ensemble for 50 cycles, and compare the resubstitution error obtained after training the ensemble for more cycles.

Load the 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 and examine the resubstitution error.

ens = fitrensemble(X,MPG,'NumLearningCycles',50);
L = resubLoss(ens)
L = 0.5563

Train for 50 more cycles and examine the new resubstitution error.

ens = resume(ens,50);
L = resubLoss(ens)
L = 0.3463

The resubstitution error is lower in the new ensemble than in the original.

Extended Capabilities