[Rspamd-Users] Bayes learning question.

Vsevolod Stakhov vsevolod at rspamd.com
Fri Nov 22 09:02:56 UTC 2019


On 22/11/2019 08:40, Daniel, Sebastian wrote:
> Hello,
> 
> this depends on your Configuration....
> Show us your Bayes Config...  or  as descriped here: https://rspamd.com/doc/configuration/statistic.html :
> 
> 
> From version 1.1, Rspamd supports autolearning for statfiles. Autolearning is applied after all rules are processed (including statistics) if and only if the same symbol has not been inserted. E.g. a message won't be learned as spam if BAYES_SPAM is already in the results of checking.
> 
> There are 3 possibilities to specify autolearning:
> 
> autolearn = true: autolearning is performing as spam if a message has reject action and as ham if a message has negative score
> autolearn = [-5, 5]: autolearn as ham if score is less -5 and as spam if score is more than 5
> autolearn = "return function(task) ... end": use the following Lua function to detect if autolearn is needed (function should return 'ham' if learn as ham is needed and string 'spam' if learn as spam is needed, if no learn is needed then a function can return anything including nil)
> Redis backend is highly recommended for autolearning purposes since it's the only backend with high concurrency level when multiple writers are properly synchronized.

This is outdated and this usage is highly discouraged. The default
configuration specifies the correct ways to do it:

```
learn_condition = 'return require("lua_bayes_learn").can_learn';

 # Autolearn sample
 # autolearn {
 #  spam_threshold = 6.0; # When to learn spam (score >= threshold)
 #  ham_threshold = -0.5; # When to learn ham (score <= threshold)
 #  check_balance = true; # Check spam and ham balance
 #  min_balance = 0.9; # Keep diff for spam/ham learns for at least this
value
 #}
```

In general, it is enough to set something like:

```
autolearn {}
```

in `local.d/classifier-bayes.conf` to enable the modern way to perform
autolearning.

I will update docs at some point (maybe)...


More information about the Users mailing list