Main Content

growTrees

R2026b

Train additional trees and add to ensemble

Syntax

B = growTrees(B,ntrees)
B = growTrees(B,ntrees,'param1',val1,'param2',val2,...)

Description

B = growTrees(B,ntrees) grows ntrees new trees and appends them to those trees already stored in the ensemble B.

B = growTrees(B,ntrees,'param1',val1,'param2',val2,...) specifies optional parameter name/value pairs:

'NumPrint'Specifies that a diagnostic message showing training progress should display after every value training cycles (grown trees). Default is no diagnostic messages.
'Options'

A struct that specifies options that govern computation when growing the ensemble of decision trees. One option requests that the computation of decision trees on multiple bootstrap replicates uses multiple processors, if the Parallel Computing Toolbox™ is available. Two options specify the random number streams to use in selecting bootstrap replicates. You can create this argument with a call to statset. You can retrieve values of the individual fields with a call to statget. Applicable statset parameters are:

  • 'UseParallel' — Option to perform computations in parallel, specified as "off", "auto", or "on". Set this value to "auto" or "on" to run computations in parallel. If you specify "auto", MATLAB® uses a parallel pool if one is available, otherwise runs in serial. If you specify "on", MATLAB uses a parallel pool if one is available, otherwise throws an error. The default is "off".

    For dual-core systems and above, TreeBagger parallelizes training using Intel® Threading Building Blocks (TBB). Therefore, using the 'UseParallel' option on a single computer may not speed up computation much and may consume more memory than in serial. For details on Intel TBB, see https://www.intel.com/content/www/us/en/developer/tools/oneapi/onetbb.html.

  • UseSubstreams — Set to true to compute in a reproducible fashion. Default is false. To compute reproducibly, set Streams to a type allowing substreams: 'mlfg6331_64' or 'mrg32k3a'.

  • Streams — A RandStream object or cell array of such objects. If you do not specify Streams, growTrees uses the default stream or streams. If you choose to specify Streams, use a single object except in the case

    • UseParallel is "on" or "auto"

    • UseSubstreams is false

    In that case, use a cell array the same size as the Parallel pool.

Extended Capabilities

expand all

Version History

expand all