Skip to content

Commit 9145f9d

Browse files
author
Marius Burkard
committed
- added rspamd neural network config
1 parent b1d8181 commit 9145f9d

File tree

3 files changed

+61
-0
lines changed

3 files changed

+61
-0
lines changed

install/lib/installer_base.lib.php

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1337,6 +1337,18 @@ public function configure_rspamd() {
13371337
exec('cp tpl/rspamd_options.inc.master /etc/rspamd/local.d/options.inc');
13381338
}
13391339

1340+
if(file_exists($conf['ispconfig_install_dir'].'/server/conf-custom/install/rspamd_neural.conf.master')) {
1341+
exec('cp '.$conf['ispconfig_install_dir'].'/server/conf-custom/install/rspamd_neural.conf.master /etc/rspamd/local.d/neural.conf');
1342+
} else {
1343+
exec('cp tpl/rspamd_neural.conf.master /etc/rspamd/local.d/neural.conf');
1344+
}
1345+
1346+
if(file_exists($conf['ispconfig_install_dir'].'/server/conf-custom/install/rspamd_neural_group.conf.master')) {
1347+
exec('cp '.$conf['ispconfig_install_dir'].'/server/conf-custom/install/rspamd_neural_group.conf.master /etc/rspamd/local.d/neural_group.conf');
1348+
} else {
1349+
exec('cp tpl/rspamd_neural_group.conf.master /etc/rspamd/local.d/neural_group.conf');
1350+
}
1351+
13401352
exec('chmod a+r /etc/rspamd/local.d/* /etc/rspamd/override.d/*');
13411353

13421354
$tpl = new tpl();
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
servers = 127.0.0.1:6379;
2+
enabled = true;
3+
4+
rules {
5+
"LONG" {
6+
train {
7+
max_trains = 5000;
8+
max_usages = 200;
9+
max_iterations = 25;
10+
learning_rate = 0.01,
11+
spam_score = 8;
12+
ham_score = -2;
13+
}
14+
symbol_spam = "NEURAL_SPAM_LONG";
15+
symbol_ham = "NEURAL_HAM_LONG";
16+
ann_expire = 100d;
17+
}
18+
"SHORT" {
19+
train {
20+
max_trains = 100;
21+
max_usages = 2;
22+
max_iterations = 25;
23+
learning_rate = 0.01,
24+
spam_score = 8;
25+
ham_score = -2;
26+
}
27+
symbol_spam = "NEURAL_SPAM_SHORT";
28+
symbol_ham = "NEURAL_HAM_SHORT";
29+
ann_expire = 1d;
30+
}
31+
}
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
symbols = {
2+
"NEURAL_SPAM_LONG" {
3+
weight = 3.0; # sample weight
4+
description = "Neural network spam (long)";
5+
}
6+
"NEURAL_HAM_LONG" {
7+
weight = -3.0; # sample weight
8+
description = "Neural network ham (long)";
9+
}
10+
"NEURAL_SPAM_SHORT" {
11+
weight = 2.0; # sample weight
12+
description = "Neural network spam (short)";
13+
}
14+
"NEURAL_HAM_SHORT" {
15+
weight = -1.0; # sample weight
16+
description = "Neural network ham (short)";
17+
}
18+
}

0 commit comments

Comments
 (0)