Quantcast
Viewing all articles
Browse latest Browse all 4448

How does R calculate the probabilities in Naive Bayes

@data_hacks wrote:

hello,

In Naive Bayes we calculate the predicted probabilities by:
Image may be NSFW.
Clik here to view.

I am applying Naive Bayes on the below data:
Image may be NSFW.
Clik here to view.

While trying to interpret the below output:
Image may be NSFW.
Clik here to view.

I am not being able to match the predicted probabilities with the formula for NaiveBayes.The test dataset looks like:
Image may be NSFW.
Clik here to view.

So for the first record,we need to find:
Max(P(C = y|VP = n,IP = n),P(C = n|VP = n,IP = n)).
Now when I try to find:
P(C = y|VP = n,IP = n) = P(C = y|VP = n)*P(C = y|IP = n)=
P(C = y))(P(VP = n|C = y))(P(VP = n|C = y))
Then:
1.(P(C = y)) = 0.1449145, from the A priori prob.
2.(P(VP = n|C = y)) = {P(C = y|VP = n)*P(VP = n)/P(C = y)} ={0.8343685 * 0.72/0.1449} = 4.14
Now this is surely wrong,but I am not being able to figure out why.
Can someone please help me with this.
The total records in the dataset is 3333.Other required figures are in the image.

Posts: 1

Participants: 1

Read full topic


Viewing all articles
Browse latest Browse all 4448

Trending Articles