Context
rspamd can use neural nets to detect spam. Since we have a setup with redis I tried it and got it working after a while.
Description
neural nets add some extra detection power to detecting spam besides bayes statistics.
Its poorly documented so I thought I might share a working example.
I am not quite sure how good it performs.
It needs to be trained for a week or more if you have low volumes of spam and ham
Alternatives
non
Applicable Users
everyone wanting better anti spam detection
Are you going to implement it?
Yes, because I know the probability of someone else doing it is low and I can learn from it.
What are you going to contribute?
well, my working configuration
vi /var/lib/docker/volumes/mailserver_Tconfig/_data/user-patches.sh
## enable ai anti spam settings
cp /tmp/docker-mailserver/neural.conf etc/rspamd/local.d/
cp /tmp/docker-mailserver/neural_group.conf etc/rspamd/local.d/
cp /tmp/docker-mailserver/logging.inc etc/rspamd/local.d/
vi /var/lib/docker/volumes/mailserver_Tconfig/_data/neural.conf
#https://github.com/rspamd/rspamd/issues/3099
rules {
"NEURAL_WEEK_1000" {
train {
max_trains = 1000;
max_usages = 50;
max_iterations = 25;
learning_rate = 0.01,
spam_score = 8;
ham_score = -2;
}
symbol_spam = "NEURAL_WEEK_SPAM";
symbol_ham = "NEURAL_WEEK_HAM";
ann_expire = 300d;
}
"NEURAL_DAYS_200" {
train {
max_trains = 200;
max_usages = 10;
max_iterations = 25;
learning_rate = 0.01,
spam_score = 8;
ham_score = -2;
}
symbol_spam = "NEURAL_DAYS_SPAM";
symbol_ham = "NEURAL_DAYS_HAM";
ann_expire = 100d;
}
"NEURAL_HALF_DAY_50" {
train {
max_trains = 50;
max_usages = 4;
max_iterations = 25;
learning_rate = 0.01,
spam_score = 8;
ham_score = -2;
}
symbol_spam = "NEURAL_HALF_DAY_SPAM";
symbol_ham = "NEURAL_HALF_DAY_HAM";
ann_expire = 13d;
}
}
vi /var/lib/docker/volumes/mailserver_Tconfig/_data/neural_group.conf
symbols = {
"NEURAL_WEEK_SPAM" {
weight = 3.0; # sample weight
description = "Neural network spam (long)";
}
"NEURAL_WEEK_HAM" {
weight = -3.0; # sample weight
description = "Neural network ham (long)";
}
"NEURAL_DAYS_SPAM" {
weight = 2.5; # sample weight
description = "Neural network spam (medium)";
}
"NEURAL_DAYS_HAM" {
weight = -1.5; # sample weight
description = "Neural network ham (medium)";
}
"NEURAL_HALF_DAY_SPAM" {
weight = 2.0; # sample weight
description = "Neural network spam (short)";
}
"NEURAL_HALF_DAY_HAM" {
weight = -1.0; # sample weight
description = "Neural network ham (short)";
}
}
##only do this for troubleshooting
vi /var/lib/docker/volumes/mailserver_Tconfig/_data/logging.inc
#this is log config file for rspamd
debug_modules = ["neural"];
type = "syslog";
level = "info";
color = false;
systemd = false;
Context
rspamd can use neural nets to detect spam. Since we have a setup with redis I tried it and got it working after a while.
Description
neural nets add some extra detection power to detecting spam besides bayes statistics.
Its poorly documented so I thought I might share a working example.
I am not quite sure how good it performs.
It needs to be trained for a week or more if you have low volumes of spam and ham
Alternatives
non
Applicable Users
everyone wanting better anti spam detection
Are you going to implement it?
Yes, because I know the probability of someone else doing it is low and I can learn from it.
What are you going to contribute?
well, my working configuration