commit 781f316: [Fix] Neural: Fix training
Vsevolod Stakhov
vsevolod at highsecure.ru
Thu Mar 28 15:56:03 UTC 2019
Author: Vsevolod Stakhov
Date: 2019-03-28 15:49:19 +0000
URL: https://github.com/rspamd/rspamd/commit/781f3162dda790d0d4d00431204ef49b326cd699
[Fix] Neural: Fix training
Issue: #2793
---
src/plugins/lua/neural.lua | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
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
More information about the Commits
mailing list