I have been playing around with two R packages for naive Bayes classification (e1071 and klaR) using the Iris dataset as an example.

During the training phase, the outpur of the apriori probabilities for each class, is 0.3333 for the three of them.

A-priori probabilities:
setosa versicolor  virginica 
0.3333333  0.3333333  0.3333333

Why is the same probability for the three classes? Does it means that if I test my model using an unknown flower, theres 33% of it being classified as setosa, versicolor or virginica?



The iris data has three sets of fifty of each class. Without doing any analysis, it should be obvious that a randomly-selected example from the iris data has a one-third chance of belonging to those classes. This is what a priori means.

  • $\begingroup$ Yes, but it could be misleading if the data were deliberately collected that way. It seems pretty unlikely that the species would occur in those frequencies in nature. $\endgroup$ – dsaxton Jul 28 '15 at 0:31
  • $\begingroup$ @dsaxton I suspect that the data were deliberately collected that way, but I don't see how that bears on what the naive bayes software is doing. $\endgroup$ – Sycorax says Reinstate Monica Jul 28 '15 at 3:29
  • $\begingroup$ It doesn't. I was only pointing out that the proportions can't always be treated as meaningful estimates of class prior probabilities. $\endgroup$ – dsaxton Jul 28 '15 at 3:45

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.