]> git.ipfire.org Git - thirdparty/rspamd.git/commitdiff
[Minor] Fix stupid change to call Redis for each class
authorVsevolod Stakhov <vsevolod@rspamd.com>
Fri, 25 Jul 2025 14:40:06 +0000 (15:40 +0100)
committerVsevolod Stakhov <vsevolod@rspamd.com>
Fri, 25 Jul 2025 14:40:06 +0000 (15:40 +0100)
src/libstat/backends/redis_backend.cxx
src/libstat/classifiers/bayes.c
test/functional/configs/multiclass_bayes.conf

index a0305ec8d1c6f5f9c7aa7d425d2bd45fa4d30a1c..1ebdab15e91cd573b9f0f068ef70899a89670904 100644 (file)
@@ -699,6 +699,7 @@ rspamd_redis_runtime(struct rspamd_task *task,
                                auto *other_rt = new redis_stat_runtime<float>(ctx, task, object_expanded);
                                other_rt->id = other_id;
                                other_rt->stcf = other_stcf;
+                               other_rt->need_redis_call = false;
                                other_rt->save_in_mempool(other_label);
                                msg_debug_bayes("additional runtime: statfile %s (class=%s) → id=%d",
                                                                other_stcf->symbol, other_label, other_id);
index 3d1bd7107469a86b507feab17b21b79bce163983..405168f910abf9fc80dc4f6ddc0e5eb752a6ade3 100644 (file)
@@ -467,6 +467,7 @@ bayes_classify_multiclass(struct rspamd_classifier *ctx,
 
        /* Find maximum for numerical stability */
        for (i = 0; i < cl.num_classes; i++) {
+               msg_debug_bayes("class %s, log_prob: %.2f", cl.class_names[i], cl.class_log_probs[i]);
                if (cl.class_log_probs[i] > max_log_prob) {
                        max_log_prob = cl.class_log_probs[i];
                        winning_class_idx = i;
index 5b8d077341c986529292fb57d64a4c7c3e48b4ae..e58a390569de92798be5a443ebe283bb374a8293 100644 (file)
@@ -120,9 +120,8 @@ classifier {
                skip_threshold = 0.95;
        }
 
-       # Standard configuration
-       min_learns = 10;
-       min_tokens = 11;
+       min_learns = 1;
+       min_tokens = 1;
        min_prob_strength = 0.05;
 
        {% if env.STATS_PER_USER ~= '' %}