我正在使用该precrec
软件包来评估多个模型并绘制 ROC 和 PR-ROC。
我想在最后做一个模型比较,但似乎我不能在同一个图上绘制两个模型。
这是我的尝试:
library(precrec)
library(caret)
library(e1071)
classifier = svm(formula = Class ~ .,
data = train_smote_maison,
type = 'C-classification',
kernel = "linear",
probability = TRUE,
cross = 3,
cost = 1)
test_svm_plot = df[train.test.split == 2,]
predictions_svm2 <- predict(classifier,newdata = test_svm_plot, probability=T)
svm2_predict_obj <- mmdata(as.numeric(predictions_svm2),test_svm_plot$Class)
svm2_perfromance <- evalmod(svm2_predict_obj)
classifier_logreg <- glm(data = train, family = "binomial",
formula = Class ~ .)
test_glm = test
test_glm_plot = df[train.test.split == 2,]
predictions_logreg <- predict(classifier_logreg,newdata = test_glm, type = "response")
logreg_predict_obj <- mmdata(predictions_logreg,test_glm$Class)
logreg_performance <- evalmod(mdat = logreg_predict_obj)
plot(svm2_perfromance, "ROC")
plot(logreg_performance, "ROC", add=TRUE, col='red')
有人知道如何确保我可以在同一个情节上获得两个 ROC 吗?
提前致谢。