本文介绍了glmnet套索ROC图表的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在glmnet(实现套索回归)中使用了k倍交叉验证,但是我无法由此生成ROC图表.

I was using k-fold cross validation in glmnet (which implements lasso regression), but I can’t make the ROC charts from this.

library(glmnet)
glm_net <- cv.glmnet(dev_x_matrix,dev_y_vector,family="binomial",type.measure="class")
phat <- predict(glm_net,newx=val_x_matrix,s="lambda.min")

那给我一个向量,看起来像拟合值的对数.在此之后,我试图生成一些ROC图表,但是它不起作用.我认为是由于glmnet中x和y对象的性质.你有什么想法.

That gets me a vector with what looks like a log of the fitted values. I was trying to generate some ROC charts after this but it did not work. I think it is because of the nature of the x and y objects which goes into the glmnet. Do you have any ideas.

推荐答案

require("glmnet")

只需更改度量,您将获得AUC.它不是ROC曲线,但提供了等效的信息.

Just change the measure and you will get AUC. It's not a ROC curve but provides equivalent information.

glm_net <- cv.glmnet(x, y, family="binomial", type.measure="auc")
plot(glm_net)

这里是我正在训练的模型中的一个示例,只是为了展示它的外观.顺便提一句.该算法非常快!

Here is an example in a model i'm training, just to show how it looks.BTW. The algorithm is extremely fast!

有关更多模型可视化技术的信息,请查看 ROCr程序包

For more model visualization techniques, check out the ROCr package

这篇关于glmnet套索ROC图表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-20 23:28