【发布时间】:2018-04-25 16:19:35
【问题描述】:
我有这样的数据集
train <- sample(1:nrow(df), nrow(df)*0.80)
train <- df[train, ]
test <- df[-train, ]
NaiveBayes1 <-naiveBayes(purchased ~ .,data=train)
pre1 <- predict(NaiveBayes1,test,probability = TRUE)
library(pROC)
roc1 <- roc(test$purchased, pre1$posterior[,1])
我得到这个错误:
pre1$posterior 中的错误:$ 运算符对原子向量无效
我已经在课堂上使用 LDA 完成了,它有效,但对于 naivebays,它不起作用。任何帮助将不胜感激。
【问题讨论】:
标签: r naivebayes roc