Do you know the classical problem of sunny / rainy / overcast days and output yes / no the game will played. See the image below. Now the problem question is "Players will play if weather is sunny. Is this statement is correct?" And the computation using Naive Bayes is as follows:

P(Yes | Sunny) = P( Sunny | Yes) * P(Yes) / P (Sunny)

P (Sunny |Yes) = 3/9 = 0.33, P(Sunny) = 5/14 = 0.36, P( Yes)= 9/14 = 0.64

My question is, why should I use Naive Bayes and not a Common sense simple computation 3 / 5 = 0.6 probability (sunny yes / sunny yes + sunny no).

enter image description here

  • $\begingroup$ Please explain the "classical problem". $\endgroup$ May 10, 2020 at 9:25
  • $\begingroup$ @RolazaroAzeveires classical problem is as follows sunny / rain = game yes / no $\endgroup$
    – luky
    May 10, 2020 at 11:11

2 Answers 2


First of all, this is not Naive Bayes, but a direct application of Bayes theorem. It would be naive Bayes if you had multiple features and assumed independence to approximate the likelihood. Bayes theorem can be used to "invert" conditional probabilities, so if you are given $P(B|A)$, you can obtain

$$ P(A|B) = \frac{P(B|A)\,P(A)}{P(B)} $$

If you are given all the data needed to calculate $P(A|B)$ directly, then you don't need it. Here you can find worked example of using Bayes theorem where we do not have the information directly available, so we use Bayes theorem to calculate the probabilities from other sources. There are also other uses of Bayes theorem, but this falls far beyond scope of your question, you can check other questions tagged as if you are curious.


If i go by your problem which can be summarized as follows:

Given features - weather (sunny/overcast/rainy)
Target - To predict whether one should play or not.

Now since we have only one feature, so it makes sense to not train any machine learning model(be it be Naive Bayes, KNN, etc). Your approach will work fine, i.e we can simply calculate the probability using each feature, which is obviously easy to calculate given only one feature, and then by majority vote we can reach to the conclusion.

Naive Bayes is useful when we have several independent features, in which we learn the likelihood of different features in training data during the training phase.

Hope this helps!.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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