# How to record performance of a glmnet model on a new dataset

I used cv.glmnet to create a model using one dataset ("Dataset 1"), but now I would like to look at performance (e.g., AUC) when predicting outcomes for new data ("Dataset 2"). I know that I can use predict.glmnet to predict new data, but the output is just a list of predicted outcomes for each observation in Dataset 2. How do I actually summarize the predictive performance (e.g., AUC) of a cv.glmnet model on on Dataset 2?

For example, it would be nice to be able to save the predictions for Dataset 2 as a new column. From there I can just calculate performance myself manually, but ideally I'd like to know if there is a way to have these indices calculated for me.

Here is one way using the pROC library in R:

labels = c(1,1,1,0,0,1,0,1,0)
pred = c(.1,.1,.3,0,0.1,.6,0.2,.8,0)

library(pROC)
auc(roc(labels, pred))


returns

Area under the curve: 0.85

• Thank you! Sometimes I have a harder time finding answers to the simplest problems than more complex ones. – Jdclark Apr 2 at 18:27