]> git.ipfire.org Git - thirdparty/rspamd.git/commitdiff
Fix percentages for bayes confidence
authorVsevolod Stakhov <vsevolod@highsecure.ru>
Thu, 14 Jan 2016 09:04:16 +0000 (09:04 +0000)
committerVsevolod Stakhov <vsevolod@highsecure.ru>
Thu, 14 Jan 2016 09:04:16 +0000 (09:04 +0000)
src/libstat/classifiers/bayes.c

index 3204efc16155dca80059d9a646e2d61dc090719b..901e00a335789d60458b524771ea656387b1f35b 100644 (file)
@@ -286,7 +286,11 @@ bayes_classify (struct rspamd_classifier * ctx,
                        final_prob = 1.0 - final_prob;
                }
 
-               rspamd_snprintf (sumbuf, 32, "%.2f%%", final_prob * 100.);
+               /*
+                * Bayes p is from 0.5 to 1.0, but confidence is from 0 to 1, so
+                * we need to rescale it to display correctly
+                */
+               rspamd_snprintf (sumbuf, 32, "%.2f%%", (final_prob - 0.5) * 200.);
                final_prob = bayes_normalize_prob (final_prob);
                g_assert (st != NULL);
                cur = g_list_prepend (NULL, sumbuf);