diff options
author | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2015-05-02 22:15:58 +0100 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2015-05-02 22:15:58 +0100 |
commit | 5f3bb4f68fe846158b45842cf3d5d577f8d4f11f (patch) | |
tree | 695f8887369db01513141c486eaee8a64fb265ac /src/libstat | |
parent | a6cd2a702ff1dcc24105638c466f82f257d6011e (diff) | |
download | rspamd-5f3bb4f68fe846158b45842cf3d5d577f8d4f11f.tar.gz rspamd-5f3bb4f68fe846158b45842cf3d5d577f8d4f11f.zip |
Revert bad change that caused negative probabilities.
Diffstat (limited to 'src/libstat')
-rw-r--r-- | src/libstat/classifiers/bayes.c | 4 |
1 files changed, 1 insertions, 3 deletions
diff --git a/src/libstat/classifiers/bayes.c b/src/libstat/classifiers/bayes.c index b3ffe2254..acd04f602 100644 --- a/src/libstat/classifiers/bayes.c +++ b/src/libstat/classifiers/bayes.c @@ -164,7 +164,7 @@ bayes_classify (struct classifier_ctx * ctx, 2 * rt->processed_tokens); s = 1 - inv_chi_square (-2. * rt->ham_prob, 2 * rt->processed_tokens); - final_prob = (s + 1 - h) / 2.; + final_prob = (s + 1.0 - h) / 2.; msg_debug ("<%s> got ham prob %.2f -> %.2f and spam prob %.2f -> %.2f," " %L tokens processed of %ud total tokens", task->message_id, rt->ham_prob, h, rt->spam_prob, s, @@ -195,8 +195,6 @@ bayes_classify (struct classifier_ctx * ctx, "unexpected classifier error: cannot select desired statfile"); } else { - /* Calculate ham probability correctly */ - final_prob = (final_prob - 0.5) * 2; rspamd_snprintf (sumbuf, 32, "%.2f%%", final_prob * 100.); cur = g_list_prepend (NULL, sumbuf); rspamd_task_insert_result (task, |