Cdlemon
2022-05-16 21:05
采纳率: 0%
浏览 54

医学生R语言临床预测模型随机森林ROC曲线问题

data.rf<-randomForest(as.factor(glaucoma)~.,data = traindata,
importance=TRUE,proximity=TRUE)
pred_out_1<-predict(data.rf,newdata=testdata,type="prob")
ran_roc <- roc(testdata$glaucoma,pred_out_1)
#提示错误
Setting levels: control = 0, case = 1
Error in roc.default(testdata$glaucoma, pred_out_1) :
Response and predictor must be vectors of the same length.
In addition: Warning message:
In roc.default(testdata$glaucoma, pred_out_1) :
Deprecated use a matrix as predictor. Unexpected results may be produced, please pass a numeric vector.

img

img

用R语言随机森林做临床预测模型,做ROC曲线出现这种错误,不懂啊--

  • 写回答
  • 好问题 提建议
  • 追加酬金
  • 关注问题
  • 邀请回答

2条回答 默认 最新

相关推荐 更多相似问题