]> source.dussan.org Git - rspamd.git/commitdiff
[Minor] Filter NaNs from ANN training vectors
authorVsevolod Stakhov <vsevolod@highsecure.ru>
Wed, 28 Jun 2017 07:26:05 +0000 (08:26 +0100)
committerVsevolod Stakhov <vsevolod@highsecure.ru>
Wed, 28 Jun 2017 07:26:05 +0000 (08:26 +0100)
src/plugins/lua/fann_scores.lua

index 4737c7ba04ac68227b0a9b7e1df8ab9ffb6c2b37..e6c7eade489ba44beb59f68236a647565580a151 100644 (file)
@@ -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))