diff options
author | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2013-11-15 18:39:00 +0000 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2013-11-15 18:39:00 +0000 |
commit | 29ea337d8d38af6babd3ad012b91b022a61bbb0f (patch) | |
tree | d38ceb2adc6fde24326e730d92589022298701d5 | |
parent | 91d2c0b8425613791ac890e672b34d8d07807ba8 (diff) | |
download | rspamd-29ea337d8d38af6babd3ad012b91b022a61bbb0f.tar.gz rspamd-29ea337d8d38af6babd3ad012b91b022a61bbb0f.zip |
Fix bayes algorithm.
-rw-r--r-- | src/classifiers/bayes.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/classifiers/bayes.c b/src/classifiers/bayes.c index c892488bd..184a63802 100644 --- a/src/classifiers/bayes.c +++ b/src/classifiers/bayes.c @@ -161,12 +161,12 @@ bayes_classify_callback (gpointer key, gpointer value, gpointer data) if (cur->value > 0) { cur->total_hits += cur->value; if (cur->st->is_spam) { - spam_count ++; + spam_count += cur->value; } else { - ham_count ++; + ham_count += cur->value; } - total_count ++; + total_count += cur->value; } } @@ -294,7 +294,7 @@ bayes_classify (struct classifier_ctx* ctx, statfile_pool_t *pool, GTree *input, final_prob = (s + 1 - h) / 2.; } - if (final_prob > 0 && fabs (final_prob - 0.5) > 0.05) { + if (data.processed_tokens > 0 && fabs (final_prob - 0.5) > 0.05) { sumbuf = memory_pool_alloc (task->task_pool, 32); for (i = 0; i < cnt; i ++) { |