resume
Resume training of classification ensemble model
Description
specifies additional options using one or more name-value arguments. For example,
you can track the number of weak learners as they are trained, and set options for
computing in parallel.ens1 = resume(ens,nlearn,Name=Value)
Examples
Train a classification ensemble for three cycles, and compare the resubstitution error obtained after training the ensemble for more cycles.
Load the ionosphere data set.
load ionosphereTrain a classification ensemble for three cycles and examine the resubstitution error.
ens = fitcensemble(X,Y,Method="GentleBoost",NumLearningCycles=3);
L = resubLoss(ens)L = 0.0085
Train for three more cycles and examine the new resubstitution error.
ens1 = resume(ens,3); L = resubLoss(ens1)
L = 0
The resubstitution error is much lower in the new ensemble than the original.
Input Arguments
Classification ensemble model, specified as a ClassificationEnsemble or
ClassificationBaggedEnsemble
model object trained with fitcensemble.
Note
You cannot resume training when ens is a model
trained with these options set for fitcensemble:
Method="Subspace" and
NumLearningCycles="AllPredictorCombinations".
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 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.
Tip
For the fastest training of some boosted decision trees, when the
classification Method is
"AdaBoostM1",
"AdaBoostM2", "GentleBoost",
or "LogitBoost", set NPrint
to "off" (the default value).
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 | 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
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'.
This function fully supports GPU arrays. For more information, see Run MATLAB Functions on a GPU (Parallel Computing Toolbox).
Version History
Introduced in R2011a
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.
Website auswählen
Wählen Sie eine Website aus, um übersetzte Inhalte (sofern verfügbar) sowie lokale Veranstaltungen und Angebote anzuzeigen. Auf der Grundlage Ihres Standorts empfehlen wir Ihnen die folgende Auswahl: .
Sie können auch eine Website aus der folgenden Liste auswählen:
So erhalten Sie die bestmögliche Leistung auf der Website
Wählen Sie für die bestmögliche Website-Leistung die Website für China (auf Chinesisch oder Englisch). Andere landesspezifische Websites von MathWorks sind für Besuche von Ihrem Standort aus nicht optimiert.
Amerika
- América Latina (Español)
- Canada (English)
- United States (English)
Europa
- 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)