# How to interpret specific plot of logistic regression (LASSO)?

So I am fitting a logistic regression model to a training data set in R, more specifically a LASSO regression with an L1 penalty. The code for the model looks like this:

t1 <- Sys.time()
glmnet_classifier <- cv.glmnet(x = dtm_train_tfidf,
y = tweets_train[['sentiment']],
family = 'binomial',
# L1 penalty
alpha = 1,
# interested in the area under ROC curve
type.measure = "auc",
# 5-fold cross-validation
nfolds = 5,
# high value is less accurate, but has faster training
thresh = 1e-3,
# again lower number of iterations for faster training
maxit = 1e3)
print(difftime(Sys.time(), t1, units = 'mins'))


When I plot(glmnet_classifier)this is what I receive:

Now my question: How do I interpret this plot? It shows AUC values across the range of different lambda. On top, I guess these are the dummy variables? So in my case, 24911 dummy variables were retained in the model? Is there a proper name for such a graph? Any help on naming the plot would be greatly appreciated! I know this is not a specific coding question, but it is coding related and I am in big need of a bright mind who could help with my question. Thank you

## migrated from stackoverflow.comMay 3 '18 at 11:38

This question came from our site for professional and enthusiast programmers.

• Plot name: performance vs regularization strength? or as the help of the function states: ?glmnet::plot.cv.glmnet: the cross-validation curve as a function of the lambda values used. In your case low or no regularization provides the highest performance. – missuse May 3 '18 at 9:28
• @missuse thank you so much for your help! Does that mean that my model performs best when most of the parameters are kept in the model instead of setting them to zero? So, there really is no purpose of adding a regularization penalty term? – Lucinho91 May 3 '18 at 9:35
• Glad to help. Well it depends, how many features are there? This plot just says that from all the lambda used the lowest was best. Using no regularization would probably be out of the question with 25k features. – missuse May 3 '18 at 9:38
• @missuse There are over 25.5 k features. So some got set to zero by LASSO, right (aprox. 600)? What does the lowest lambda mean? I know that lambda indicates the penalty term. A low lambda means that there is less penalty? Any help is tremendously appreciated!!! Also do you know how to plot the ROC-Curve from this? – Lucinho91 May 3 '18 at 9:42
• check this and this answer for glmnet. To make a ROC curve you would need the predictions on the hold out data, check this answer. If still having trouble post a fully reproducible question with an inbuilt data set. – missuse May 3 '18 at 9:51