Skip to contents

Each round fits, for every class, a least-squares tree to y_ik - p_k(x_i) and sets each leaf to leaf_scale sum r / sum |r| (1 - |r|) (ESL Alg. 10.4, eq 10.57, leaf_scale = (K - 1) / K; gbm's multinomial uses 1), shrunk by nu; p_k is the softmax of the K functions (eq 10.21).

Usage

morie_esl_gbm_multiclass(
  X,
  g,
  M = 100,
  nu = 0.1,
  max_depth = 1,
  min_leaf = 1,
  query = NULL,
  leaf_scale = NULL
)

Arguments

X

Predictors.

g

Class labels.

M

Rounds.

nu

Shrinkage.

max_depth, min_leaf

Tree controls.

query

Points to classify (default X).

leaf_scale

Newton step factor (default (K - 1) / K).

Value

Named list: prob, prediction, deviance_path, classes, trees.

References

Friedman, J. (2001). Annals of Statistics 29, 1189-1232.

Examples

i <- 1:60
X <- cbind(sin(i) + ((i %% 3) == 0) * 1.5, cos(2 * i))
morie_esl_gbm_multiclass(X, i %% 3, M = 5)$deviance_path
#> [1] 126.0375 121.4441 117.7253 114.3567 111.4577