lasso_multi | R Documentation |
the function realizes L1-regularized classification for multinomial response variable using ISTA / FISTA algorithm
lasso_multi(data,y,x,lambda,max_step=10000,image=FALSE,fista=TRUE)
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 |
lasso_multi
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.
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)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.