4

I generated a naive Bayes classifier using e1071 and then ran the following

test <- as.data.frame(readRDS('ContactsComplaints2014.rds'))
load(file='data2015.nb.RData')
prediction <- predict(data2015.nb,subset(test[1:3000,], select=-c(didComplain)))

In the terminal I entered

> prediction

and got

factor(0)
Levels:

Why?

wlad
  • 2,073
  • 2
  • 18
  • 29

1 Answers1

4

You need to label the names of the classes you want to classify as as.factor(). Then it will work.

nbro
  • 15,395
  • 32
  • 113
  • 196
tristndev
  • 367
  • 2
  • 14