Main Content


Class: TreeBagger

Train additional trees and add to ensemble


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


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.

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' — If true and if a parpool of the Parallel Computing Toolbox is open, compute decision trees drawn on separate bootstrap replicates in parallel. If the Parallel Computing Toolbox is not installed, or a parpool is not open, computation occurs in serial mode. Default is false, or serial computation.

  • UseSubstreams — Set to true to compute in parallel 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 true

    • UseSubstreams is false

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

Extended Capabilities