From: Vsevolod Stakhov Date: Thu, 28 Mar 2019 15:49:19 +0000 (+0000) Subject: [Fix] Neural: Fix training X-Git-Tag: 1.9.1~29 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=781f3162dda790d0d4d00431204ef49b326cd699;p=rspamd.git [Fix] Neural: Fix training Issue: #2793 --- diff --git a/src/plugins/lua/neural.lua b/src/plugins/lua/neural.lua index 4e268962c..b75adf468 100644 --- a/src/plugins/lua/neural.lua +++ b/src/plugins/lua/neural.lua @@ -620,7 +620,10 @@ local function train_ann(rule, _, ev_base, elt, worker) local n = rspamd_config:get_symbols_count() + meta_functions.rspamd_count_metatokens() local filt = function(elts) - return #elts == n + -- Basic sanity checks: vector has good length + there are no + -- 'bad' values such as NaNs or infinities in its elements + return #elts == n and + not fun.any(function(e) return e ~= e or e == math.huge or e == -math.huge end, elts) end -- Now we can train ann