Click here to Skip to main content
15,886,110 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
hello dear i saw this article to learning about naive bayes.
here is the article :

Naive Bayes Classifier[^]

so far i am understand the theory
but i cant understand how to get this RESULT

p(weight | male) = 5.9881e-06 <--- THIS RESULT
p(foot size | male) = 1.3112e-3 <--- THIS RESULT
posterior numerator (male) = their product = 6.1984e-09 <--- THIS RESULT

p(height | female) = 2.2346e-1 <--- THIS RESULT
p(weight | female) = 1.6789e-2 <--- THIS RESULT
p(foot size | female) = 2.8669e-1 <--- THIS RESULT
posterior numerator (female) = their product = 5.3778e-04 <--- THIS RESULT

wish someone explain to me step by step to get this result.
thank you dear,,
Posted
Comments
Suvendu Shekhar Giri 3-Dec-15 13:31pm    
Just a suggestion: Ask the author. He might be able to give you exact explanation.
Gun Gun Febrianza 3-Dec-15 13:35pm    
but he never respon the comments in his article.
BillWoodruff 4-Dec-15 10:12am    
Did you download the source code for the article and compile it ?

Unfortunately, last time this user was seen was almost five years ago.

You may have to get back to the wikipedia article he is talking about, and get some clue about how values are computed. You may also study the source code of said article to catch how it works.

I have read the article, but could not explain it to you without having to go through the steps I described above.
 
Share this answer
 
The same formula is used for all the calculation

p(x) = 1/sqrt(2*PI*σ2) * exp(-(x - μ)2/2*σ2)

where
x is the sample value (length, weight or foot size)
μ is the mean value
σ2 is the variance

So in numbers for the weight for the male it will be
x = 130
μ = 176.25
σ2 = 122.92

p(weight|male) = 1/sqrt(2*PI*122.92) * exp(-(130 - 176.25)2/2*122.92) =
1/27.79 * exp(-8.70) = 5.9881E-6
(In reality I kept the values in the memory of the calculator, so if you use these values directly the result will differ a bit)

Then it is just a matter to do the same for the foot size
x = 8
μ = 11.25
σ2 = 0.91667
p(foot|male) = 1/sqrt(2*PI*0.91667) * exp(-(8 - 11.25)2/2*0.91667) =
1/2.40 * exp(-5.76) = 1.3112E-3

And so on for the female.
 
Share this answer
 
v2
Comments
Gun Gun Febrianza 30-Dec-15 17:17pm    
thanks so much john :)
George Jonsson 30-Dec-15 18:40pm    
Who is John?
Gun Gun Febrianza 5-Jan-16 5:06am    
your name is johnson right? george johnson :)
George Jonsson 10-Jan-16 7:40am    
My name is George Jonsson, where the first name is George.
Gun Gun Febrianza 3-Feb-16 8:27am    
thanks george jonsson :)

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900