Naive Bayes norm function

6 views
Skip to first unread message

Tazin Afrin

unread,
Sep 14, 2013, 10:55:05 PM9/14/13
to cs...@googlegroups.com
The function is :
function norm(x,m,s) {
    return 1/sqrt(2*pi*s^2)*e^(-1*(x-m)^2/(2*s^2))
}
And the inputs are 
m = mean
s = standard deviation
x = the value we are trying to score
In the example,  f(temperature=66|yes) = norm(73,6/2,66) =0.0340 , are the arguments in right order? I do not understand how the output is 0.0340, why the input for sd is 6/2 not 6.2 ? 
And in the function, is it (1/sqrt)*e or 1/(sqrt*e) ?
- Tazin

Tim Menzies

unread,
Sep 15, 2013, 4:19:53 PM9/15/13
to cs...@googlegroups.com
thanks*1000 for your query. please keep'em coming!

apologies from me- there are typos in the example. it should be

norm(66, 73, 6.2) = 0.0340

as to your other query, here's the function, with the algebra written
more clearly, and all the constants explicitly defined:

function norm(x,m,s) {
pi= 3.1415926535
e = 2.7182818284
a = 1/sqrt( 2*pi*s^2 )
b = (x-m)^2 / (2*s^2)
return a * e ^ (-1*b)
> --
> You received this message because you are subscribed to the Google Groups
> "csx73" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to csx73+un...@googlegroups.com.
> For more options, visit https://groups.google.com/groups/opt_out.



--
:: there are some who call me... t...@menzies.us
:: prof @ cs.ai.se.csee.wvu.usa.sol.virgo.all.nil
:: +1-304-376-2859
:: http://menzies.us (skype = menzies.tim)

<hubris>
vita= http://goo.gl/8eNhY
pubs= http://goo.gl/8KPKA
stats= http://goo.gl/vggy1
wow = http://goo.gl/2Wg9A
</hubris>

Tazin Afrin

unread,
Sep 15, 2013, 4:32:52 PM9/15/13
to cs...@googlegroups.com
Thank you :)
 - Tazin
Reply all
Reply to author
Forward
0 new messages