aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2018-11-16 09:28:40 +0000
committerVsevolod Stakhov <vsevolod@highsecure.ru>2018-11-16 09:28:40 +0000
commit3cb9102e94d6e3017c9573e2d778ac49a5de64fe (patch)
tree63d7284ea743385defbfb9876ad1ed63a17e0de6 /src
parentdf529a8d06aa25285362175c75c5275b9566b0b1 (diff)
downloadrspamd-3cb9102e94d6e3017c9573e2d778ac49a5de64fe.tar.gz
rspamd-3cb9102e94d6e3017c9573e2d778ac49a5de64fe.zip
[Minor] Fix formula
Diffstat (limited to 'src')
-rw-r--r--src/libstat/classifiers/bayes.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/src/libstat/classifiers/bayes.c b/src/libstat/classifiers/bayes.c
index 2e710522b..5295e018b 100644
--- a/src/libstat/classifiers/bayes.c
+++ b/src/libstat/classifiers/bayes.c
@@ -344,22 +344,22 @@ bayes_classify (struct rspamd_classifier * ctx,
return TRUE;
}
- if (cl.spam_prob < -300 && cl.ham_prob < -300) {
+ if (cl.spam_prob > -300 && cl.ham_prob > -300) {
/* Fisher value is low enough to apply inv_chi_square */
h = 1 - inv_chi_square (task, cl.spam_prob, cl.processed_tokens);
s = 1 - inv_chi_square (task, cl.ham_prob, cl.processed_tokens);
}
else {
/* Use naive method */
- if (cl.spam_prob > cl.ham_prob) {
- s = (1.0 - exp(cl.spam_prob / cl.ham_prob)) /
- (1.0 + exp(cl.spam_prob / cl.ham_prob));
- h = 1.0 - s;
+ if (cl.spam_prob < cl.ham_prob) {
+ h = (1.0 - exp(cl.spam_prob - cl.ham_prob)) /
+ (1.0 + exp(cl.spam_prob - cl.ham_prob));
+ s = 1.0 - h;
}
else {
- h = (1.0 - exp(cl.ham_prob / cl.spam_prob)) /
- (1.0 + exp(cl.ham_prob / cl.spam_prob));
- s = 1.0 - h;
+ s = (1.0 - exp(cl.ham_prob - cl.spam_prob)) /
+ (1.0 + exp(cl.ham_prob - cl.spam_prob));
+ h = 1.0 - s;
}
}