lasso_multi_back | R Documentation |
the function carries out the Lasso regression for multinomial response using backtraking line research and FISTA/ISTA algorithm.
lasso_multi_back(data,y,x,lambda,max_step=10000,image=FALSE,fista=TRUE,tol=10^-7,ini=0)
data |
name of the dataset |
y |
name of the dependent variables |
x |
name of the independent variable |
lambda |
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 |
tol |
tolerance for the convergence |
ini |
initial value for the coefficients, default is 0 #'@examples library(glmnet) data("MultinomialExample") x<-MultinomialExample$x y<-MultinomialExample$y mult<-as.data.frame(cbind(x,y)) lasso_multi_back(mult,y="y",x=colnames(mult)[-31],max_step = 1000,lambda=0.01,image=TRUE,fista=TRUE,ini=0) |
lasso_multi_back
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.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.