resume
Resume training of cross-validated 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
Cross-Validate Regression Ensemble Augmented with Additional Training
Examine the cross-validation error after training a regression 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.
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.
Input Arguments
ens
— Cross-validated regression ensemble model
RegressionPartitionedEnsemble
model object
Cross-validated regression ensemble model, specified as a RegressionPartitionedEnsemble
model
object created with one of these functions:
fitrensemble
with one of these five cross-validation name-value argumentCrossVal
,KFold
,Holdout
,Leaveout
, orCVPartition
crossval
applied to aRegressionEnsemble
model object
nlearn
— Number of additional training cycles
positive integer
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=true))
specifies to train ens
for an additional 10 cycles, display a
message to the command line every time resume
finishes
training 5 folds, and perform computations in parallel.
NPrint
— Printout frequency
"off"
(default) | positive integer
Printout frequency, specified as a positive integer m
or
"off"
. resume
displays a
message to the command line every time it finishes training
m
folds. If you specify "off"
,
resume
does not display a message when it
completes training folds.
Tip
For the fastest training of some boosted decision trees, when the
regression method is "LSBoost"
, set
NPrint
to "off"
(the default
value).
Example: NPrint=5
Data Types: single
| double
| char
| string
Options
— Options for computing in parallel and setting random number streams
structure
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 | false |
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 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 ,
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 true
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.
Example: Options=statset(UseParallel=true)
Data Types: struct
Extended Capabilities
Automatic Parallel Support
Accelerate code by automatically running computation in parallel using Parallel Computing Toolbox™.
resume
supports parallel training
using the 'Options'
name-value argument. Create options using statset
, such as options = statset('UseParallel',true)
.
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'
.
GPU Arrays
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).
Version History
Introduced in R2012b
See Also
kfoldLoss
| kfoldPredict
| kfoldfun
| RegressionPartitionedEnsemble
| fitrensemble
Comando de MATLAB
Ha hecho clic en un enlace que corresponde a este comando de MATLAB:
Ejecute el comando introduciéndolo en la ventana de comandos de MATLAB. Los navegadores web no admiten comandos de MATLAB.
Select a Web Site
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list:
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Americas
- América Latina (Español)
- Canada (English)
- United States (English)
Europe
- 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)