diff options
author | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2019-03-28 15:49:19 +0000 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2019-03-28 15:49:19 +0000 |
commit | 781f3162dda790d0d4d00431204ef49b326cd699 (patch) | |
tree | ade72e6bc25e74658d33b12fbe88615e131fae66 /src/plugins/lua/neural.lua | |
parent | a19fbaaec3697b26cf660dcf52ff00b1c8b6c601 (diff) | |
download | rspamd-781f3162dda790d0d4d00431204ef49b326cd699.tar.gz rspamd-781f3162dda790d0d4d00431204ef49b326cd699.zip |
[Fix] Neural: Fix training
Issue: #2793
Diffstat (limited to 'src/plugins/lua/neural.lua')
-rw-r--r-- | src/plugins/lua/neural.lua | 5 |
1 files changed, 4 insertions, 1 deletions
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 |