]> source.dussan.org Git - rspamd.git/commitdiff
Calculate bayes weight from 0.0 to 1.0 not from 0.5 to 1.0.
authorVsevolod Stakhov <vsevolod@highsecure.ru>
Mon, 13 Apr 2015 16:18:25 +0000 (17:18 +0100)
committerVsevolod Stakhov <vsevolod@highsecure.ru>
Mon, 13 Apr 2015 16:18:25 +0000 (17:18 +0100)
src/libstat/classifiers/bayes.c

index 823f5eff9ad1baafc89430199e83d8354589990d..1e516ecbb8b1318d093a358f15153c5084657a58 100644 (file)
@@ -194,9 +194,7 @@ bayes_classify (struct classifier_ctx * ctx,
                        }
                        else {
                                /* Calculate ham probability correctly */
-                               if (final_prob < 0.5) {
-                                       final_prob = 1. - final_prob;
-                               }
+                               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,