svn commit: r1932149 - spamassassin/trunk/lib/Mail/SpamAssassin/Plugin

[email protected]
Newsgroups gmane.mail.spam.spamassassin.cvs
Message-ID <177261887217.3716915.11006573329783609416@svn02-us-east.apache.org>
Author: gbechis
Date: Wed Mar  4 10:07:51 2026
New Revision: 1932149

Log:
consider only non zero hits and use the correct vector size

Modified:
   spamassassin/trunk/lib/Mail/SpamAssassin/Plugin/NeuralNetwork.pm

Modified: spamassassin/trunk/lib/Mail/SpamAssassin/Plugin/NeuralNetwork.pm
==============================================================================
--- spamassassin/trunk/lib/Mail/SpamAssassin/Plugin/NeuralNetwork.pm	Wed Mar  4 09:24:04 2026	(r1932148)
+++ spamassassin/trunk/lib/Mail/SpamAssassin/Plugin/NeuralNetwork.pm	Wed Mar  4 10:07:51 2026	(r1932149)
@@ -661,7 +661,7 @@ sub learn_message {
       # Vocabulary grew: preserve the trained model by adjusting the training vectors
       my $model_size = $existing_network->num_inputs();
       dbg("Vocabulary size changed ($num_input vs model $model_size), adjusting training vectors");
-      $feature_vectors = [ map { { vec => _adjust_vector_size($_->{vec}, $model_size), hits => $_->{hits} } } @$feature_vectors ];
+      $feature_vectors = [ map { my $v = _adjust_vector_size($_->{vec}, $model_size); { vec => $v, hits => scalar grep { $_ != 0 } @$v } } @$feature_vectors ];
       $num_input = $model_size;
       $network = $existing_network;
     } else {
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.