我有以下数据,我想知道我是否在关于随机森林模型的正确轨道上
我运行以下randomForest模型但是当我去绘制ROC时,我的轴看起来很偏,我相信它可能与我的模型有关,但找不到我出错的地方。 x轴从1.0开始而不是0 ....
fit <- randomForest(as.factor(status) ~ CA.TA + CA.CL + EBIT.TA + CF.TL + WC.TA + WC.S + TL.TA + C.TA,
data = train,
importance = TRUE,
#type = "prob",
ntree = 200)
prediction <- NULL
prediction$status_prediction <- as.data.frame(predict(fit, test))
prediction$status_prediction_prob <- predict(fit, test, type = "prob")
prediction <- NULL
prediction$status_prediction <- predict(fit, test)
prediction <- as.data.frame(prediction)
prediction$status_prediction_prob <- predict(fit, test, type = "prob")
library(caret)
confusionMatrix(prediction$status_prediction, test$status)
prediction$status_prediction <- as.numeric(prediction$status_prediction)
library(pROC)
result.roc <- roc(test$status, prediction$status_prediction)
plot(result.roc, print.thres="best", print.thres.best.method="closest.topleft", main = "ROC curve", print.auc = TRUE)
auc(test$status, prediction$status_prediction)