# Calculation misclassification error rate in glmnet (LASSO)

Using glmnet, different metrics can be used to find the optimal value for log lambda, using cross-validation. For example, the maximum ROC-AUC for classification, or the minimum misclassification error rate.

Let's assume our glmnet model has a binary response (e.g., disease, yes vs. no).

Different steps in glmnet: (1) Define coefficient path for model predictors as function of log lambda. (2) X-fold cross-validation to find optimal log lambda that corresponds with lowest cross-validation misclassification error rate. (3) Apply log lambda that corresponds with lowest cross-validation misclassification error rate to find coefficients for markers in the glmnet model.

The misclassification error rate is a simple metric based on a confusion matrix. But, it requires a dichotomous variable (predicted disease, yes vs. no), not a continuous variable. So, in the glmnet algorithm, how exactely are the predicted classes defined?

• Assuming glmnet restore a continuous variable: The decision where to cut who's positive and who's negative is yours to make, and in most times it's a "business" dilemma. If you, however, just interested in quantify how "good" is your model, you should measure it with AUC ROC. Here's an explanation on the matter: gim.unmc.edu/dxtests/roc3.htm Nov 27, 2017 at 14:24
• "If you, however, just interested in quantify how "good" is your model, you should measure it with AUC ROC." I am going to have to disagree with this comment. Yes, AUC tell's you how good your model is at rank ordering, but it does not tell you about the accuracy of model, which has plenty of business application (reserves for banks comes to mind). I understand that CV has its limitations, but the way this comment is worded, it treats AUC as a one-size-fits-all metric, which it is not.
– Josh
Nov 27, 2017 at 16:07