Categories &

Functions List

Function Reference: templateTree

statistics: T = templateTree ()
statistics: T = templateTree (name, value)

Create a template for a binary decision tree.

T = templateTree () returns a template carrying the default options of ClassificationTree. A template names a learner and the options it is to be fitted with, without fitting anything: it is given to a function that fits many models, such as fitcecoc, which uses it for every binary learner it trains.

T = templateTree (name, value) also stores the given options. They are the name-value arguments of fitctree, and any of them may be given here instead.

 
 T = templateTree ('MaxNumSplits', 5, 'MinLeafSize', 3);
 Mdl = fitcecoc (X, Y, 'Learners', T);

T is a structure carrying Method, Type and one field per option given.

Deviation from MATLAB

MATLAB returns an object of a class whose name we cannot use, which has no public properties and one method this package declines package wide, so a structure carries everything a user can observe. This is what ModelParameters already does throughout the package.

An option name is not checked here. ClassificationTree owns the list of options it takes and checks it when the template is used, so a name it does not know is refused then rather than now.

See also: fitcecoc, ClassificationTree, fitctree

Source Code: templateTree