aboutsummaryrefslogtreecommitdiffstats
path: root/src/libstat/classifiers/bayes.c
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2015-05-06 12:46:29 +0100
committerVsevolod Stakhov <vsevolod@highsecure.ru>2015-05-06 12:46:29 +0100
commit0fb417de5ca09cae92923ceb27c33f4865ba7ad5 (patch)
tree6f1436194cb39263a5a3f1bd49a974ac28cd9404 /src/libstat/classifiers/bayes.c
parent4c7e7cb362a1589b1a326f3f69bc918430e82bfd (diff)
downloadrspamd-0fb417de5ca09cae92923ceb27c33f4865ba7ad5.tar.gz
rspamd-0fb417de5ca09cae92923ceb27c33f4865ba7ad5.zip
Properly scale bayes HAM probability.
Diffstat (limited to 'src/libstat/classifiers/bayes.c')
-rw-r--r--src/libstat/classifiers/bayes.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/libstat/classifiers/bayes.c b/src/libstat/classifiers/bayes.c
index abb02bd90..d04341c3c 100644
--- a/src/libstat/classifiers/bayes.c
+++ b/src/libstat/classifiers/bayes.c
@@ -31,8 +31,6 @@
#include "cfg_file.h"
#include "stat_internal.h"
-#define LOCAL_PROB_DENOM 16.0
-
static inline GQuark
bayes_error_quark (void)
{
@@ -209,6 +207,11 @@ bayes_classify (struct classifier_ctx * ctx,
"unexpected classifier error: cannot select desired statfile");
}
else {
+ /* Correctly scale HAM */
+ if (final_prob < 0.5) {
+ final_prob = 1.0 - final_prob;
+ }
+
rspamd_snprintf (sumbuf, 32, "%.2f%%", final_prob * 100.);
cur = g_list_prepend (NULL, sumbuf);
rspamd_task_insert_result (task,