aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2017-06-28 08:26:05 +0100
committerVsevolod Stakhov <vsevolod@highsecure.ru>2017-06-28 08:26:05 +0100
commit27895da18643c7ccabc48e6eac2587a1f919038c (patch)
tree1bb779744843b2b06d46bed23fbf998ce173f119
parentd59bcf73d33b0029b617aa1b37ac9ea761948e46 (diff)
downloadrspamd-27895da18643c7ccabc48e6eac2587a1f919038c.tar.gz
rspamd-27895da18643c7ccabc48e6eac2587a1f919038c.zip
[Minor] Filter NaNs from ANN training vectors
-rw-r--r--src/plugins/lua/fann_scores.lua1
1 files changed, 1 insertions, 0 deletions
diff --git a/src/plugins/lua/fann_scores.lua b/src/plugins/lua/fann_scores.lua
index 4737c7ba0..e6c7eade4 100644
--- a/src/plugins/lua/fann_scores.lua
+++ b/src/plugins/lua/fann_scores.lua
@@ -50,6 +50,7 @@ local function symbols_to_fann_vector(syms, scores)
local n = rspamd_config:get_symbols_count()
fun.each(function(s, score)
+ if score ~= score then score = 0.0 end -- nan sanity
matched_symbols[s + 1] = rspamd_util.tanh(score)
end, fun.zip(syms, scores))