templateEnsemble
statistics: T = templateEnsemble (Method, NLearn, Learners)
statistics: T = templateEnsemble (…, name, value)
Create a template for an ensemble learner.
T = templateEnsemble (Method, NLearn,
Learners) returns a template for an ensemble grown by Method
from NLearn learners, each fitted as Learners says. A template
names a learner and the options it is to be fitted with, without fitting
anything: it is given to fitcecoc, which grows one such ensemble for
every binary learner it trains.
Method is one of the methods of fitcensemble or
fitrensemble, in any letter case. NLearn is the number of
learning cycles and Learners a learner name, such as
'tree', or a template of one, such as templateTree returns;
they are the 'NumLearningCycles' and 'Learners' options of
fitcensemble.
T = templateEnsemble (…, name, value)
also stores the given options. They are the name-value arguments of
fitcensemble, such as 'LearnRate'.
T = templateEnsemble ('GentleBoost', 50, templateTree ('MaxNumSplits', 1));
Mdl = fitcecoc (X, Y, 'Learners', T);
|
T is a structure carrying Method, Type,
LearnerTemplates, NLearn and one field per option given.
Type is 'regression' for LSBoost and
'classification' for every other method; a 'Type' option
may choose it for Bag, which serves both.
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.
Only the method is checked here. The ensemble owns the list of options it
takes and checks them, NLearn and Learners included, when the
template is used, so a value it refuses is refused then rather than now.
MATLAB checks 'LearnRate' already here.
See also: fitcecoc, fitcensemble, templateTree
Source Code: templateEnsemble