resume
R2026bResume training of regression ensemble model
Description
specifies additional options using one or more name-value arguments. For example,
you can specify the printout frequency, and set options for computing in
parallel.ens1 = resume(ens,nlearn,Name=Value)
Examples
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.
Input Arguments
Regression ensemble model, specified as a RegressionEnsemble or RegressionBaggedEnsemble model object trained with fitrensemble.
Number of additional training cycles for ens, specified as a positive
integer.
Data Types: double | single
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.
Example: resume(ens,10,NPrint=5,Options=statset(UseParallel="auto"))
specifies to train ens for an additional 10 cycles, display a
message to the command line every time resume finishes
training 5 weak learners, and to perform computations in parallel.
Printout frequency, specified as a positive integer
m or "off".
resume displays a message to the command
line every time it finishes training m weak learners.
If you specify "off",
resume does not display a message when it
completes training weak learners.
Example: NPrint=5
Data Types: single | double | char | string
Options for computing in parallel and setting random number streams, specified as a
structure. Create the Options structure using statset.
Note
You need Parallel Computing Toolbox™ to run computations in parallel.
You can use the same parallel options for resume as you used for the
original training. Use the Options argument to change the parallel options,
as needed. This table describes the option fields and their values.
| Field Name | Value | Default |
|---|---|---|
UseParallel | Set this value to Parallel ensemble training requires you to set the | "off" |
UseSubstreams | Set this value to To compute reproducibly, set
| false |
Streams | Specify this value as a RandStream object or cell array of such objects. Use a single object
except when the UseParallel value is "on" or
"auto" 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,
resume uses the default stream or streams. |
For dual-core systems and above, resume parallelizes training
using Intel® Threading Building Blocks (TBB). Therefore, setting
UseParallel to "on" or "auto" might not provide a significant
increase in speed on a single computer. For details on Intel TBB, see https://www.intel.com/content/www/us/en/developer/tools/oneapi/onetbb.html.
Before R2026b: To run computations in parallel, set
UseParallel to true.
Example: Options=statset(UseParallel="auto")
Data Types: struct
Extended Capabilities
resume supports parallel training
using the Options name-value argument. Set the
UseParallel field of the options structure to "on" or
"auto" using statset. 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".
This function fully supports GPU arrays. For more information, see Run MATLAB Functions on a GPU (Parallel Computing Toolbox).
Version History
Introduced in R2011aThe UseParallel field of the Options name-value
argument now accepts "off", "auto", or
"on" values instead of true or
false. This change gives you more control over when to use a parallel
pool for parallel execution. Specifying the UseParallel field as
true or false is not recommended.
This table shows how to update your code depending on your goal.
| Goal | Not Recommended | Recommended |
|---|---|---|
Write code that runs on the MATLAB® client. |
Options=statset(UseParallel=false)
|
Options=statset(UseParallel="off")
|
| Write portable code that runs on a parallel pool and, if a pool is not available, runs on the MATLAB client. |
Options=statset(UseParallel=true)
|
Options=statset(UseParallel="auto")
|
| Write code that runs on a parallel pool and errors if a pool is not available. | N/A |
Options=statset(UseParallel="on")
|
There are no plans to remove support for the true or
false values.
See Also
fitrensemble | RegressionEnsemble | RegressionBaggedEnsemble
MATLAB Command
You clicked a link that corresponds to this MATLAB command:
Run the command by entering it in the MATLAB Command Window. Web browsers do not support MATLAB commands.
选择网站
选择网站以获取翻译的可用内容,以及查看当地活动和优惠。根据您的位置,我们建议您选择:。
您也可以从以下列表中选择网站:
如何获得最佳网站性能
选择中国网站(中文或英文)以获得最佳网站性能。其他 MathWorks 国家/地区网站并未针对您所在位置的访问进行优化。
美洲
- América Latina (Español)
- Canada (English)
- United States (English)
欧洲
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)