aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2015-01-28 15:39:32 +0000
committerVsevolod Stakhov <vsevolod@highsecure.ru>2015-01-28 15:39:32 +0000
commitff7aec707dd37abe4f2bd71ddee50cfa5499c98d (patch)
tree1c7bb78c6b37cfeca8e2fdad5b3f567587a83216 /src
parent7fd5a65a11d756618ddc51a22f005efdc108ba45 (diff)
downloadrspamd-ff7aec707dd37abe4f2bd71ddee50cfa5499c98d.tar.gz
rspamd-ff7aec707dd37abe4f2bd71ddee50cfa5499c98d.zip
Some fixes to bayes.
Diffstat (limited to 'src')
-rw-r--r--src/libstat/classifiers/bayes.c4
-rw-r--r--src/libstat/stat_process.c1
2 files changed, 4 insertions, 1 deletions
diff --git a/src/libstat/classifiers/bayes.c b/src/libstat/classifiers/bayes.c
index 979329d4e..be6c6f545 100644
--- a/src/libstat/classifiers/bayes.c
+++ b/src/libstat/classifiers/bayes.c
@@ -103,6 +103,8 @@ bayes_classify_callback (gpointer key, gpointer value, gpointer data)
ham_count += res->value;
}
total_count += res->value;
+ res->st_runtime->total_hits += res->value;
+ res->cl_runtime->processed_tokens ++;
}
}
@@ -160,6 +162,8 @@ bayes_classify (struct classifier_ctx * ctx,
s = 1 - inv_chi_square (-2. * rt->ham_prob,
2 * rt->processed_tokens);
final_prob = (s + 1 - h) / 2.;
+ msg_debug ("<%s> got ham prob %.2f -> %.2f and spam prob %.2f -> %.2f",
+ task->message_id, rt->ham_prob, h, rt->spam_prob, s);
}
if (rt->processed_tokens > 0 && fabs (final_prob - 0.5) > 0.05) {
diff --git a/src/libstat/stat_process.c b/src/libstat/stat_process.c
index b0e8ffdb9..022edde7d 100644
--- a/src/libstat/stat_process.c
+++ b/src/libstat/stat_process.c
@@ -109,7 +109,6 @@ preprocess_init_stat_token (gpointer k, gpointer v, gpointer d)
if (st_runtime->backend->process_token (t, res,
st_runtime->backend->ctx)) {
- cl_runtime->processed_tokens ++;
if (cl_runtime->clcf->max_tokens > 0 &&
cl_runtime->processed_tokens > cl_runtime->clcf->max_tokens) {