Skip to contents

Maximises the multinomial log-likelihood minus lambda sum_k sum_j |beta_kj| in the symmetric parametrisation (ESL eqs 18.10, 18.19) by cycling over the classes with IRLS quadratic approximations and lasso coordinate descent, as glmnet's ungrouped multinomial. Intercepts are centred; lambda is N times glmnet's.

Usage

morie_esl_multinomial_l1(
  X,
  g,
  lambda,
  max_outer = 500,
  max_inner = 10000,
  tol = 1e-12
)

Arguments

X

Predictors, n by p.

g

Class labels.

lambda

Penalty.

max_outer, max_inner, tol

Iteration controls.

Value

Named list: intercepts, coefficients (K by p), classes, loglik, objective, prob, converged.

References

Friedman, J., Hastie, T. & Tibshirani, R. (2010). JSS 33(1).

Examples

i <- 1:60
X <- cbind(sin(i), cos(3 * i))
morie_esl_multinomial_l1(X, ifelse(sin(i) > 0.3, 0, ifelse(cos(3 * i) > 0, 1, 2)), 1.5)$coefficients
#>          [,1]      [,2]
#> [1,] 4.961363  0.000000
#> [2,] 0.000000  2.275950
#> [3,] 0.000000 -1.910676