Skip to contents

Regress the class indicator columns on (1, x) and classify to the largest fitted value (ESL eqs 4.3-4.6).

Usage

morie_esl_indicator_regression(X, g, query = NULL)

Arguments

X

Predictors, N by p.

g

Class labels.

query

Points to classify (default X).

Value

Named list: prediction, fitted, coefficients ((p + 1) by K), classes.

References

Hastie, Tibshirani & Friedman (2009), sec. 4.2.

Examples

i <- 1:30
morie_esl_indicator_regression(cbind(sin(i), cos(i)), i %% 3, rbind(c(0, 1)))$prediction
#> [1] 1