aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2015-11-23 01:23:38 +0000
committerVsevolod Stakhov <vsevolod@highsecure.ru>2015-11-23 01:23:38 +0000
commit7cc0bdd4c447238451b9ffb8e16f5d97a2b7e21e (patch)
tree950aeb13d409fe5a797c97ee7142b572116048ce /src
parentd5406ab737dcfb791e88200227f91943e636c6aa (diff)
downloadrspamd-7cc0bdd4c447238451b9ffb8e16f5d97a2b7e21e.tar.gz
rspamd-7cc0bdd4c447238451b9ffb8e16f5d97a2b7e21e.zip
Fix calculations
Diffstat (limited to 'src')
-rw-r--r--src/libstat/classifiers/bayes.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/libstat/classifiers/bayes.c b/src/libstat/classifiers/bayes.c
index c3832400b..2a7ea2b89 100644
--- a/src/libstat/classifiers/bayes.c
+++ b/src/libstat/classifiers/bayes.c
@@ -48,10 +48,11 @@ bayes_error_quark (void)
static gdouble
inv_chi_square (gdouble value, gint freedom_deg)
{
- double prob, sum;
+ double prob, sum, m;
gint i;
errno = 0;
+ m = -value;
prob = exp (value);
if (errno == ERANGE) {
@@ -62,7 +63,8 @@ inv_chi_square (gdouble value, gint freedom_deg)
sum = prob;
for (i = 1; i < freedom_deg; i++) {
- prob *= value / (gdouble)i;
+ prob *= m / (gdouble)i;
+ msg_debug_bayes ("prob: %.6f", prob);
sum += prob;
}