2018-10-16
閱讀量:
2486
決策樹畫roc曲線的折點問題
使用的是pROC包,關于roc()的參數我有點疑惑,modelroc <- roc(my第一個mydata.testy是實際數據里y變量的值,res_cost是我使用C50包構建決策樹之后用predict.C5.0函數得到的預測結果,這兩個都是factor的vector應該是,然后直接運行的話報錯:第二個參數必須是numeric或者有序的,我就用as.numeric把res_cost轉換成數字最后得到的圖像是一條直線沒有折點,如何設置更多的折點?
tree <- rpart(HCAI ~ hospital + age + gender + admseason + low_protein + UC + UN + UCN + UCL + UNL + LOS + fever + LOSICU + surnum + preoperative + postoperative + postoperative_ant + postoperative_antD + bacterial_culture + antibiotic + antibioticD + comb_ant + comb_antD + spec_ant + spec_antD??+ sing_antD + doub_antD + Trip_antD + blood_exam + abblood + uri_exam + aburi + ventilatorD + ventilatorT + cvcD + cvcT + uriD + uriT + add, method = "class", data = LR_train)
tree
#ROC曲線的繪制
library(pROC)
froc <- roc(LR_trainHCAI,treey)
HCAI,treey)
froc
plot(froc, print.auc = TRUE, auc.polygon = TRUE, legacy.axes = TRUE,
? ???grid = c(0.1, 0.2), grid.col = c("green", "red"), max.auc.polygon = TRUE,??
? ???auc.polygon.col = "skyblue", xlab = "1-specificity", ylab = "sensitivity")
ci(froc)






評論(0)


暫無數據
推薦帖子
0條評論
0條評論
0條評論