[cvs] bogofilter/src fisher.c,1.6,1.7
Fast Bayesian spam filter along lines suggested by Paul Graham
Brought to you by:
m-a
From: <re...@us...> - 2003-04-12 01:11:54
|
Update of /cvsroot/bogofilter/bogofilter/src In directory sc8-pr-cvs1:/tmp/cvs-serv31403 Modified Files: fisher.c Log Message: Revise comments and add whitespace for readability. Index: fisher.c =================================================================== RCS file: /cvsroot/bogofilter/bogofilter/src/fisher.c,v retrieving revision 1.6 retrieving revision 1.7 diff -u -d -r1.6 -r1.7 --- fisher.c 11 Apr 2003 19:03:13 -0000 1.6 +++ fisher.c 12 Apr 2003 01:11:47 -0000 1.7 @@ -91,11 +91,16 @@ double df = 2.0 * robn; double ln2 = 0.6931472; /* ln(2) */ int e; + fis_stats.robn = robn; + P.mant = frexp(P.mant, &e); P.exp += e; Q.mant = frexp(Q.mant, &e); Q.exp += e; - fis_stats.p_ln = log(P.mant) + P.exp * ln2; /* convert to natural logs */ - fis_stats.q_ln = log(Q.mant) + Q.exp * ln2; /* convert to natural logs */ + + /* convert to natural logs */ + fis_stats.p_ln = log(P.mant) + P.exp * ln2; /* invlogsum */ + fis_stats.q_ln = log(Q.mant) + Q.exp * ln2; /* logsum */ + fis_stats.p_pr = prbf(-2.0 * fis_stats.p_ln, df); /* compute P */ fis_stats.q_pr = prbf(-2.0 * fis_stats.q_ln, df); /* compute Q */ |