Naive Bayes in a Nutshell.

Type           Long | Not Long || Sweet | Not Sweet || Yellow |Not Yellow|Total
             ___________________________________________________________________
Banana      |  400  |    100   || 350   |    150    ||  450   |  50      |  500
Orange      |    0  |    300   || 150   |    150    ||  300   |   0      |  300
Other Fruit |  100  |    100   || 150   |     50    ||   50   | 150      |  200
            ____________________________________________________________________
Total       |  500  |    500   || 650   |    350    ||  800   | 200      | 1000
             ___________________________________________________________________
 
P(Banana)  = 0.5 (500/1000)
P(Orange)  = 0.3
P(Other Fruit) = 0.2
p(Long)  = 0.5
P(Sweet)  = 0.65
P(Yellow) = 0.8

P(Banana/Long, Sweet and Yellow) = (P(Long/Banana) p(Sweet/Banana).P(Yellow/Banana) x P(banana))/... 
P(Long). P(Sweet). P(Yellow) 
                                 = (0.8 x 0.7 x 0.9 x 0.5)/P(evidence)
                                 = 0.252/P(evidence) 
P(Orange/Long, Sweet and Yellow) = 0 
P(Other Fruit/Long, Sweet and Yellow) = P(Long/Other fruit) x P(Sweet/Other fruit) x P(Yellow/Other fruit) x P(Other Fruit) 
                                      = (100/200 x 150/200 x 50/150 x 200/1000) / P(evidence) 
                                      = 0.01875/P(evidence)

via algorithm – A simple explanation of Naive Bayes Classification – Stack Overflow.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

w

Connecting to %s