ROC曲线错误

时间:2017-11-13 03:20:06

标签: r naivebayes roc

我有像这样的数据集

lengthOfStrings

我收到了这个错误:

pre1 $后验错误:$运算符对原子向量无效

我在课堂上使用LDA做过,但它起作用但是对于天真的人来说,它并不起作用。任何帮助将不胜感激。

1 个答案:

答案 0 :(得分:1)

更改您的最后两行:

pre1 <- predict(NaiveBayes1, test, probability = TRUE)
roc1 <- roc(test$purchased, pre1$posterior[,1])

要:

pre1 <- predict(NaiveBayes1, test, type = "raw")
roc1 <- roc(test$purchased, pre1[,1])