[Rspamd-Users] Bayes Classifier Training Issue

Kendall Marino kendall at beehiiv.com
Mon Nov 10 15:56:15 UTC 2025


Hello again,

This time I'm running up against some trouble with training the bayes
classifier. I've made no modifications to statistic.conf and have attempted
training these ways:

1. bulk training with 'rspamadm classifier_test' pointed at ham and spam
directories of my own creation

Output:
------
Spam: 140 train files, 60 cv files; ham: 140 train files, 60 cv files
Start learn spam, 140 messages, 10 connections
Start learn ham, 140 messages, 10 connections
Learning done: 140 spam messages in 1.14 seconds, 140 ham messages in 1.68
seconds
Start cross validation, 120 messages, 10 connections
Metric               Value
------------------------------
True Positives       0
False Positives      0
True Negatives       0
False Negatives      0
Accuracy             nan
Precision            nan
Recall               nan
F1 Score             nan
Classified (%)       0.00
Elapsed time (seconds) 1.15

2. HTTP requests to /learnham and /learnspam in bulk.

Example logs:
------
2025-11-06 21:36:35 #285897(controller) <39c898>; csession;
rspamd_redis_classified: internal error: expected table result from Redis
script, got number
2025-11-06 21:36:35 #285897(controller) <39c898>; bayes; bayes_learn_class:
LEARN_CLASS: class='spam', unlearn=false, tokens=652
2025-11-06 21:36:35 #285897(controller) <39c898>; csession;
rspamd_controller_learn_fin_task: <127.0.0.1> learned message as spam:
67bc22e8624fb_287be6090933 at 590cc0c3-ef96-4fe7-92de-6dd412751bde.mail

Both approaches show that rspamd is performing the training and are
incrementing the 'Learned' statistic. I have confirmed Redis keys are being
generated each time, but I assume my problem lies in this line which was
present in the logs for each request.

'rspamd_redis_classified: internal error: expected table result from Redis
script, got number'

It's worth noting as well that I'm not seeing BAYES_HAM or BAYES_SPAM
symbols when scanning a message post-training. I'm assuming this error is
the root of the issue, but I haven't been able to figure out what's causing
it. Is it possible I'm missing some additional custom configuration?

Thanks,
Kendall


More information about the Users mailing list