2018-10-16
閱讀量:
2575
決策樹畫roc曲線的折點(diǎn)問題
使用的是pROC包,關(guān)于roc()的參數(shù)我有點(diǎn)疑惑,modelroc <- roc(my第一個(gè)mydata.testy是實(shí)際數(shù)據(jù)里y變量的值,res_cost是我使用C50包構(gòu)建決策樹之后用predict.C5.0函數(shù)得到的預(yù)測結(jié)果,這兩個(gè)都是factor的vector應(yīng)該是,然后直接運(yùn)行的話報(bào)錯(cuò):第二個(gè)參數(shù)必須是numeric或者有序的,我就用as.numeric把res_cost轉(zhuǎn)換成數(shù)字最后得到的圖像是一條直線沒有折點(diǎn),如何設(shè)置更多的折點(diǎn)?
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)






評(píng)論(0)


暫無數(shù)據(jù)
CDA考試動(dòng)態(tài)
CDA報(bào)考指南
推薦帖子
0條評(píng)論
0條評(píng)論
0條評(píng)論
0條評(píng)論