]> source.dussan.org Git - rspamd.git/commitdiff
Properly scale bayes HAM probability.
authorVsevolod Stakhov <vsevolod@highsecure.ru>
Wed, 6 May 2015 11:46:29 +0000 (12:46 +0100)
committerVsevolod Stakhov <vsevolod@highsecure.ru>
Wed, 6 May 2015 11:46:29 +0000 (12:46 +0100)
src/libstat/classifiers/bayes.c

index abb02bd90ea3fbaa06180b1118a7a6d31b2579e0..d04341c3c6d68893439e8e273f38819eb2381033 100644 (file)
@@ -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,