使用ROCR packge反转R中的截止值

时间:2015-11-12 19:58:58

标签: r roc

我正在使用混淆矩阵来创建ROC曲线。我遇到的问题是截止值受到尊重。怎么办我把它们按升序排列?

pred <- prediction(predictions =c(rep(5,19),rep(7,24),rep(9,40),rep(10,42)), labels =
c(rep(0,18),rep(1,1),rep(0,7),rep(1,17),rep(0,4),rep(1,36),rep(0,3),rep(1,39)))
perf <- performance(pred,"tpr","fpr")
plot(perf,colorize=TRUE)
abline(0,1,col='red')
x = c(0.09375,0.21875,0.43750)
y = c(0.4193548,0.8064516,0.9892473)
points(x , y , col="red", pch=19)
text(x , y+0.03, labels= c("9","7","5"), col="red", pch=19)
predictions = c(rep(5,19),rep(7,24),rep(9,40),rep(10,42))
labels = c(rep(0,18),rep(1,1),rep(0,7),rep(1,17),rep(0,4),rep(1,36),rep(0,3),rep(1,39))
auc(predictions,labels)

0 个答案:

没有答案