diff options
author | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2016-01-14 09:04:16 +0000 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2016-01-14 09:04:16 +0000 |
commit | 8803f26e7ad1fddcf0b964f6b88cbae6f3bdfa32 (patch) | |
tree | d99ba5cfc84ea5286abf9e104a99532e5f2f9c9f /src/libstat | |
parent | defcd82bfd954693cdcd1767227bfcf04e63ff59 (diff) | |
download | rspamd-8803f26e7ad1fddcf0b964f6b88cbae6f3bdfa32.tar.gz rspamd-8803f26e7ad1fddcf0b964f6b88cbae6f3bdfa32.zip |
Fix percentages for bayes confidence
Diffstat (limited to 'src/libstat')
-rw-r--r-- | src/libstat/classifiers/bayes.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src/libstat/classifiers/bayes.c b/src/libstat/classifiers/bayes.c index 3204efc16..901e00a33 100644 --- a/src/libstat/classifiers/bayes.c +++ b/src/libstat/classifiers/bayes.c @@ -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); |