【R】-ROC曲线绘制

2020-08-06 14:42:59 浏览数 (1)

>install.packages("ROCR")

> library(ROCR)

> data("ROCR.simple")

> str(ROCR.simple)

List of 2

$predictions: num [1:200] 0.613 0.364 0.432 0.14 0.385 ...

$labels : num [1:200] 1 1 0 0 0 1 1 11 0 ...

>pred<prediction(ROCR.simple

> plot(perf,colorize=T)

> plot(perf)

> plot(perf,colorize=TRUE)

> install.packages("pROC")

> library(pROC)

> data("aSAH")

>roc1<-roc(aSAH

>plot(roc1,print.auc=TRUE,auc.polygon=TRUE,grid=c(0.1,0.2),grid.col=c("green","red"),max.auc.polygon=TRUE, auc.polygon.col="skyblue",print.thres=TRUE)

> (auc1 = auc(roc1))

Area under the curve: 0.7314

0 人点赞