# Naive bayes computation of denominator

I'm wondering about the denominator in this computation :

P(Banana|Long, Sweet and Yellow)
P(Long|Banana) * P(Sweet|Banana) * P(Yellow|Banana) * P(banana)
= _______________________________________________________________
P(Long) * P(Sweet) * P(Yellow)


Which is from this post

I don't know that it is valid to convert

P(long, sweet, yellow)


to

P(long)P(sweet)P(yellow)


The reason that I'm confused is that we have conditional independence, rather than complete independence.

Or is this valid here?

# edit - text example ## 1 Answer

It isn't correct exactly for the reason you realized. The evidence calculation should be: $$P(L,S,Y)=\sum_{B'\in \{Banana,Orange,Other\}} P(L|B')P(S|B')P(Y|B')P(B')$$

However, the classification is correct because the evidence is not important in Naive Bayes classifier since it is common for all classes.

• Thank you, perhaps the other post should be edited as it seems to be quite popular? ( I found it via google search ). I'm not sure how that works between stacks and whether this suggestion is appropriate – baxx Apr 23 at 14:43
• I can post a comment there, but don’t know it’d be effective or not; it’s probably been upvoted by many with elementary probability knowledge. – gunes Apr 23 at 14:46