commit d72a817: [Minor] Neural: Fix PCA-less ANN mode

Vsevolod Stakhov vsevolod at highsecure.ru
Fri Aug 28 14:49:06 UTC 2020


Author: Vsevolod Stakhov
Date: 2020-08-28 15:42:32 +0100
URL: https://github.com/rspamd/rspamd/commit/d72a81792df5bb6d72da185b6d86765664a2fa7c (HEAD -> master)

[Minor] Neural: Fix PCA-less ANN mode

---
 src/plugins/lua/neural.lua | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/plugins/lua/neural.lua b/src/plugins/lua/neural.lua
index 0258fb0b0..225c9895b 100644
--- a/src/plugins/lua/neural.lua
+++ b/src/plugins/lua/neural.lua
@@ -776,7 +776,7 @@ local function spawn_train(worker, ev_base, rule, set, ann_key, ham_vec, spam_ve
             lr = rule.train.learning_rate,
             max_epoch = rule.train.max_iterations,
             cb = train_cb,
-            pca = set.ann.pca
+            pca = (set.ann or {}).pca
           })
 
       if not ret then
@@ -833,10 +833,10 @@ local function spawn_train(worker, ev_base, rule, set, ann_key, ham_vec, spam_ve
         local ann_data = rspamd_util.zstd_compress(data)
         local pca_data
 
+        fill_set_ann(set, ann_key)
         if set.ann.pca then
           pca_data = rspamd_util.zstd_compress(set.ann.pca:save())
         end
-        fill_set_ann(set, ann_key)
         -- Deserialise ANN from the child process
         ann_trained = rspamd_kann.load(data)
         local version = (set.ann.version or 0) + 1


More information about the Commits mailing list