commit b562090: [Test] Add neural PCA tests

Vsevolod Stakhov vsevolod at highsecure.ru
Fri Aug 28 16:42:08 UTC 2020


Author: Vsevolod Stakhov
Date: 2020-08-28 17:40:13 +0100
URL: https://github.com/rspamd/rspamd/commit/b562090c505b1cd9dd5d71734b6744b34c02f05c (HEAD -> master)

[Test] Add neural PCA tests

---
 test/functional/cases/330_neural.robot | 24 ++++++++++++++++--------
 test/functional/configs/neural.conf    | 18 ++++++++++++++++--
 2 files changed, 32 insertions(+), 10 deletions(-)

diff --git a/test/functional/cases/330_neural.robot b/test/functional/cases/330_neural.robot
index a9a338f95..e7f8418ff 100644
--- a/test/functional/cases/330_neural.robot
+++ b/test/functional/cases/330_neural.robot
@@ -26,13 +26,17 @@ Train
 Check Neural HAM
   Sleep  2s  Wait for neural to be loaded
   ${result} =  Scan Message With Rspamc  ${MESSAGE}  --header  Settings={symbols_enabled = ["HAM_SYMBOL"];groups_enabled=["neural"];symbols_disabled = ["NEURAL_LEARN"]}
-  Check Rspamc  ${result}  NEURAL_HAM_SHORT
-  Check Rspamc  ${result}  NEURAL_SPAM_SHORT  inverse=1
+  Check Rspamc  ${result}  NEURAL_HAM_SHORT (
+  Check Rspamc  ${result}  NEURAL_SPAM_SHORT (  inverse=1
+  Check Rspamc  ${result}  NEURAL_HAM_SHORT_PCA (
+  Check Rspamc  ${result}  NEURAL_SPAM_SHORT_PCA (  inverse=1
 
 Check Neural SPAM
   ${result} =  Scan Message With Rspamc  ${MESSAGE}  --header  Settings={symbols_enabled = ["SPAM_SYMBOL"];groups_enabled=["neural"];symbols_disabled = ["NEURAL_LEARN"]}
-  Check Rspamc  ${result}  NEURAL_SPAM_SHORT
-  Check Rspamc  ${result}  NEURAL_HAM_SHORT  inverse=1
+  Check Rspamc  ${result}  NEURAL_SPAM_SHORT (
+  Check Rspamc  ${result}  NEURAL_HAM_SHORT (  inverse=1
+  Check Rspamc  ${result}  NEURAL_SPAM_SHORT_PCA (
+  Check Rspamc  ${result}  NEURAL_HAM_SHORT_PCA (  inverse=1
 
 
 Train INVERSE
@@ -46,13 +50,17 @@ Train INVERSE
 Check Neural HAM INVERSE
   Sleep  2s  Wait for neural to be loaded
   ${result} =  Scan Message With Rspamc  ${MESSAGE}  --header  Settings={symbols_enabled = ["HAM_SYMBOL"];groups_enabled=["neural"]}
-  Check Rspamc  ${result}  NEURAL_SPAM_SHORT
-  Check Rspamc  ${result}  NEURAL_HAM_SHORT  inverse=1
+  Check Rspamc  ${result}  NEURAL_SPAM_SHORT (
+  Check Rspamc  ${result}  NEURAL_SPAM_SHORT_PCA (
+  Check Rspamc  ${result}  NEURAL_HAM_SHORT (  inverse=1
+  Check Rspamc  ${result}  NEURAL_HAM_SHORT_PCA (  inverse=1
 
 Check Neural SPAM INVERSE
   ${result} =  Scan Message With Rspamc  ${MESSAGE}  --header  Settings={symbols_enabled = ["SPAM_SYMBOL"];groups_enabled=["neural"]}
-  Check Rspamc  ${result}  NEURAL_HAM_SHORT
-  Check Rspamc  ${result}  NEURAL_SPAM_SHORT  inverse=1
+  Check Rspamc  ${result}  NEURAL_HAM_SHORT (
+  Check Rspamc  ${result}  NEURAL_HAM_SHORT_PCA (
+  Check Rspamc  ${result}  NEURAL_SPAM_SHORT (  inverse=1
+  Check Rspamc  ${result}  NEURAL_SPAM_SHORT_PCA (  inverse=1
 
 *** Keywords ***
 Neural Setup
diff --git a/test/functional/configs/neural.conf b/test/functional/configs/neural.conf
index 0a2ded95e..871a549fe 100644
--- a/test/functional/configs/neural.conf
+++ b/test/functional/configs/neural.conf
@@ -54,9 +54,23 @@ neural {
           symbol_spam = "NEURAL_SPAM_SHORT";
           symbol_ham = "NEURAL_HAM_SHORT";
           ann_expire = 86400;
-          watch_interval = 0.1;
+          watch_interval = 0.5;
+      }
+      SHORT_PCA {
+          train {
+              learning_rate = 0.001;
+              max_usages = 2;
+              spam_score = 1;
+              ham_score = -1;
+              max_trains = 10;
+              max_iterations = 250;
+          }
+          symbol_spam = "NEURAL_SPAM_SHORT_PCA";
+          symbol_ham = "NEURAL_HAM_SHORT_PCA";
+          ann_expire = 86400;
+          watch_interval = 0.5;
+          max_inputs = 2;
       }
-
   }
   allow_local = true;
 


More information about the Commits mailing list