diff options
author | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2015-06-25 11:55:34 +0100 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2015-06-25 11:55:34 +0100 |
commit | f2270b4f9df181f788e6feafb7ee2503dc0dffcc (patch) | |
tree | 763d9875fad8513d3d740edea3b77a19a3874ed3 /src/libstat/classifiers | |
parent | 904a3183feb07da449562775f9e9ded1c3eaba8f (diff) | |
download | rspamd-f2270b4f9df181f788e6feafb7ee2503dc0dffcc.tar.gz rspamd-f2270b4f9df181f788e6feafb7ee2503dc0dffcc.zip |
Fix floating point classification in bayes.
Diffstat (limited to 'src/libstat/classifiers')
-rw-r--r-- | src/libstat/classifiers/bayes.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/libstat/classifiers/bayes.c b/src/libstat/classifiers/bayes.c index 87cc6e464..6c17e90ca 100644 --- a/src/libstat/classifiers/bayes.c +++ b/src/libstat/classifiers/bayes.c @@ -177,7 +177,7 @@ bayes_classify (struct classifier_ctx * ctx, s = 1 - inv_chi_square (-2. * rt->ham_prob, 2 * rt->processed_tokens); - if (isnormal (s) && isnormal (h)) { + if (isfinite (s) && isfinite (h)) { final_prob = (s + 1.0 - h) / 2.; msg_debug ("<%s> got ham prob %.2f -> %.2f and spam prob %.2f -> %.2f," " %L tokens processed of %ud total tokens", @@ -189,12 +189,12 @@ bayes_classify (struct classifier_ctx * ctx, * We have some overflow, hence we need to check which class * is NaN */ - if (isnormal (h)) { + if (isfinite (h)) { final_prob = 1.0; msg_debug ("<%s> spam class is overflowed, as we have no" " ham samples", task->message_id); } - else if (isnormal (s)){ + else if (isfinite (s)){ final_prob = 0.0; msg_debug ("<%s> spam class is overflowed, as we have no" " spam samples", task->message_id); |