Categories &

Functions List

Function Reference: gamboosttrain

statistics: Mdl = gamboosttrain (X, Y, Method, NumTrees, LearnRate, MaxNumSplits)
statistics: Mdl = gamboosttrain (X, Y, Method, NumTrees, LearnRate, MaxNumSplits, Verbose, NumPrint, F0)
statistics: Mdl = gamboosttrain (…, Verbose, NumPrint)

Fit a generalized additive model of boosted trees.

Mdl = gamboosttrain (X, Y, Method, NumTrees, LearnRate, MaxNumSplits) boosts one tree per column of X in each round and returns the additive model as a structure. It is the fitting engine shared by ClassificationGAM and RegressionGAM, and it is not meant to be called directly.

  • X is an NxP numeric matrix of predictors. A missing value is not an error: the observation takes no part in the affected predictor’s trees and that term contributes nothing to its prediction.
  • Y is an Nx1 numeric vector of responses. For Method 1 it must hold zeros and ones.
  • Method selects what is boosted: 1 the logistic deviance, as a classifier is fitted, and 2 the squared error, as a regression is fitted.
  • NumTrees is the number of rounds, each fitting one tree per predictor. It is a budget rather than a count: a fit that stops improving ends earlier and says so.
  • LearnRate is the step a round starts at. A round that fails to earn its place is retried at half the step, so this is an initial value and not a fixed one.
  • MaxNumSplits is the largest number of splits any one tree may make. 1 is a stump.
  • Verbose, if greater than zero, prints a trace of the fit, and NumPrint how often: the first round and then every NumPrint rounds. The RelTol column is the relative improvement the round bought, which is what the stopping rule reads. MATLAB prints a column under the same heading holding a quantity of its own that cannot be derived from anything else it reports, so the two are not comparable.

Mdl is a structure with the following fields.

  • Intercept, the constant term the additive terms are added to. For a classifier it is fitted rather than fixed: it is seeded with the log-odds of the response mean and then collects the constant each shape function gives up when it is recentred. For a regression it is the response mean and stays there.
  • BinEdges, a 1xP cell of row vectors, the cut points each predictor was binned at.
  • ShapeValues, a 1xP cell of column vectors, one value per bin. A shape function is a step function, so this is the whole of it however many trees produced it.
  • NumTrees, the number of rounds actually performed.
  • ReasonForTermination, why fitting stopped.
  • Deviance, the deviance at the last round.
  • Residuals, the Nx1 residual vector at the last round.

See also: gamboostpredict, gamtrain, ClassificationGAM, RegressionGAM

Source Code: gamboosttrain