Skip to contents

Kernel-weighted multinomial logit on (x - x0), last class as baseline; the class probabilities at x0 are the softmax of the local intercepts (ESL eqs 6.18-6.20).

Usage

morie_esl_local_logistic(X, g, x0, lambda, kernel = "gaussian")

Arguments

X

Predictors, n by p.

g

Class labels.

x0

Targets, one per row.

lambda

Bandwidth.

kernel

"gaussian", "epanechnikov" or "tri-cube".

Value

Named list: prob (targets by classes), intercepts, classes.

References

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

Examples

i <- 1:40
morie_esl_local_logistic(cbind(sin(i), cos(3 * i)), (i * 7) %% 3, rbind(c(0.2, 0.3)), 1)$prob
#>           [,1]      [,2]      [,3]
#> [1,] 0.3058034 0.3823314 0.3118652