aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2013-05-23 17:44:21 +0100
committerVsevolod Stakhov <vsevolod@highsecure.ru>2013-05-23 17:44:21 +0100
commit9347b6450db4e7bc29a36fe84c72a1835d0f6cb6 (patch)
tree5e62e71a615e47c28a3ccdada9cdc0ab5e4e780c
parent56beefcbe41276328a062f1eee7d0c31cd98e5b9 (diff)
downloadrspamd-9347b6450db4e7bc29a36fe84c72a1835d0f6cb6.tar.gz
rspamd-9347b6450db4e7bc29a36fe84c72a1835d0f6cb6.zip
Fix probability calculations.
-rw-r--r--src/classifiers/bayes.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/classifiers/bayes.c b/src/classifiers/bayes.c
index 2a8ae44c7..24174187f 100644
--- a/src/classifiers/bayes.c
+++ b/src/classifiers/bayes.c
@@ -169,7 +169,7 @@ bayes_classify_callback (gpointer key, gpointer value, gpointer data)
spam_freq = ((double)spam_count / MAX (1., (double)cd->total_spam));
ham_freq = ((double)ham_count / MAX (1., (double)cd->total_ham));
spam_prob = spam_freq / (spam_freq + ham_freq);
- bayes_spam_prob = (0.5 + spam_prob * total_count) / (double)total_count;
+ bayes_spam_prob = (0.5 + spam_prob * total_count) / (1. + total_count);
cd->spam_probability += log (bayes_spam_prob);
cd->ham_probability += log (1. - bayes_spam_prob);
cd->processed_tokens ++;