diff options
author | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2016-10-15 13:20:29 +0100 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2016-10-15 13:34:42 +0100 |
commit | a903f7be21746c3a803d0a47dad4c0716584eaa7 (patch) | |
tree | 7be52fc0943aa6657c4f16f6a1e53c19fbe9fa9d /src/libutil | |
parent | 73639d6543db207832f663a38bf299ff26bab8bb (diff) | |
download | rspamd-a903f7be21746c3a803d0a47dad4c0716584eaa7.tar.gz rspamd-a903f7be21746c3a803d0a47dad4c0716584eaa7.zip |
[Feature] Try to improve normalization function for bayes
Diffstat (limited to 'src/libutil')
-rw-r--r-- | src/libutil/util.c | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/src/libutil/util.c b/src/libutil/util.c index 5380d8c94..d1332d504 100644 --- a/src/libutil/util.c +++ b/src/libutil/util.c @@ -2549,17 +2549,16 @@ rspamd_shmem_xmap (const char *fname, guint mode, * C = -7 * D = 3 * y = 32(x - 0.5)^4 - 6(x - 0.5)^3 - 7(x - 0.5)^2 + 3(x - 0.5) + * + * New approach: + * y = ((x - bias)*2)^8 */ gdouble rspamd_normalize_probability (gdouble x, gdouble bias) { - const gdouble a = 32, b = -6, c = -7, d = 3; - gdouble xx, x2, x3, x4; + gdouble xx; - xx = x - bias; - x2 = xx * xx; - x3 = x2 * xx; - x4 = x3 * xx; + xx = (x - bias) * 2.0; - return a*x4 + b*x3 + c*x2 + d*xx; + return pow (xx, 8); } |