如何估算多项式模型的ROC曲线

时间:2019-03-28 05:11:07

标签: r

我想估算模型Logistic回归模型的3级水平的ROC曲线和AUC。我有此代码:

Y为:“ 1”,“ 2”和“ 3”

model<-multinom(Y ~.,data = train)

predic1<-predict(model,newdata = test[,-1], type = 'prob')

library('ROCR')
pred  <-  ROCR::prediction(predic1,factor(test$Y))
plot(ROCR::performance(pred, measure="tpr" , x.measure="fpr"),
     xlab='False Positive Rate',
     ylab='True Positive Rate')
(AUC <- (attributes(ROCR::performance(pred, measure="auc"))$y.value[[1]][[1]][1]))

行:

"pred  <-  ROCR::prediction(predic1,factor(test$Y))" 

产生此错误:

Error in ROCR::prediction(predic1, factor(test$Y)) : 
  Number of cross-validation runs must be equal for predictions and labels.

任何建议,都可以估算多项式模型的ROC曲线。

0 个答案:

没有答案