lasso_multi: Lasso logistic regression for multinomial response variable...

View source: R/models.R

lasso_multiR Documentation

Lasso logistic regression for multinomial response variable with fixed step

Description

the function realizes L1-regularized classification for multinomial response variable using ISTA / FISTA algorithm

Usage

lasso_multi(data,y,x,lambda,max_step=10000,image=FALSE,fista=TRUE)

Arguments

data

name of the dataset

y

name of the dependent variables

x

name of the independent variable

lambda

a number or a vector of lambda-value to be evaluated in the regression

max_step

maximum number of steps

image

plots the evolution of errors in term of lambda values

fista

fista=TRUE: use FISTA algortihm for the multiclass logistic regression; fista=FALSE: use ISTA algortihm

Details

lasso_multi

Value

A list containing:

  • coefficients: A matrix where each column represents the estimated regression coefficients for a different lambda value.

  • error_evolution: A numeric vector tracking the error at certain step.

  • num_steps: An integer vector indicating the number of steps in which errors are calculated.

Examples

library(glmnet)
data("MultinomialExample")
x<-MultinomialExample$x
y<-MultinomialExample$y
mult<-as.data.frame(cbind(x,y))
lasso_multi(mult,y="y",x=colnames(mult)[-31],max_step = 1000,lambda=0.01,image=TRUE,fista=TRUE)

ProxReg documentation built on April 3, 2025, 9:21 p.m.