問題はありませんがあることです汎用S4
のオブジェクトの関数は、ROCR
パッケージで定義されています。しかし、追加のadd = TRUE
引数を使用した場合と同様に、汎用プロット関数を使用することができます。たとえば、これは?plot.performance
の例のページから一部です:
library(ROCR)
data(ROCR.simple)
pred <- prediction(ROCR.simple$predictions, ROCR.simple$labels)
pred2 <- prediction(abs(ROCR.simple$predictions +
rnorm(length(ROCR.simple$predictions), 0, 0.1)),
ROCR.simple$labels)
perf <- performance(pred, "tpr", "fpr")
perf2 <- performance(pred2, "tpr", "fpr")
plot(perf, colorize = TRUE)
plot(perf2, add = TRUE, colorize = TRUE)
OR、あなたは行列内のすべてのあなたの予測を保存することができ、1に後続のすべてのステップを実行します。
preds <- cbind(p1 = ROCR.simple$predictions,
p2 = abs(ROCR.simple$predictions +
rnorm(length(ROCR.simple$predictions), 0, 0.1)))
pred.mat <- prediction(preds, labels = matrix(ROCR.simple$labels,
nrow = length(ROCR.simple$labels), ncol = 2))
perf.mat <- performance(pred.mat, "tpr", "fpr")
plot(perf.mat, colorize = TRUE)
をところで、あなたの場合なんらかの理由で実際にlines
を使用して、連続したROC曲線をプロットしたいと思っていました。
plot(perf)
lines([email protected][[1]], [email protected][[1]], col = 2)
優秀!まさに私が探していたもの! – kahlo