bug in mailfilter.crm for training: wrong spam training threshold decision (+ extra: code duping / unreachable code fix)

"Ger Hobbelt" <[email protected]>
Newsgroups gmane.mail.spam.crm114
Message-ID <[email protected]>
the check to decide whether to train as spam or not is wrong - it is
exactly the same as the one for ham (another c&p error?) while it
should -- when you use :thick_threshold: as the deciding edge value --
be compared against it's NEGATIVE:

train for ham if pR < :thick_threshold:
train of spam if pR >= MINUS :thick_threshold:

-->
-----
-	    eval /:@: :*:pr: < :*:thick_threshold: : /
+            eval /:@: :*:pr: > (0 - :*:thick_threshold:) : /
-----


The diff below contains three items:

1- the above, but commented out.

2- fix of unreachable code (dang, maybe I should port crm as another
language for the gcc backend ;-) ): duplicate accept+exit

3- how #1 will look when you like train on the :good_threshold: and
:spam_threshold: edges instead of :thick_threshold:.
(Of course, that last bit makes mailfilter.crm decide on different
values than mailtrainer.crm, though, but what the hey. it was
different already :-) )

#3 is a 'matter of taste'; crawlies #1 and #2 are begging for insecticide.




--- \\Debbie\ger\prj\1original\crm114\src\crm114.sourceforge.net\src\mailfilter.crm	2008-03-05
00:06:35.000000000 +-0200
+++ \\Debbie\ger\prj\3actual\crm114\src\mailfilter.crm	2008-09-28
23:05:11.000000000 +-0200
@@ -619,31 +591,29 @@
 		    #   No, it didn't exist.  Add an error message header.
 		    call /:mungmail_add:/ [X-CRM114-ERROR: No cached text with that
cacheID, so nothing done!]
 		    accept
 		    exit /:*:accepted_mail_exit_code:/
 		}
 	}
-	{     #  No cacheing, so we learn "natively"
+        {
+            #  No cacheing, so we learn "natively"
 		#
 		#    Verify that we need to learn this first (TOE strategy)
 		classify <:*:clf:> [:text:] /:*:lcr:/ \
 		  (:*:fileprefix::*:nonspamcss: :*:fileprefix::*:spamcss: ) \
 		  (:classify_status:)
 		match [:classify_status:] <nomultiline> \
 			/^#0.* pR: ([-. 0-9]+)/ (:: :pr:)
-		eval /:@: :*:pr: < :*:thick_threshold: :/
+            eval /:@: :*:pr: < :*:good_threshold: :/    # was
comparison against 'think_threshold'
 		output [:*:fileprefix:nonspamtext.txt] \
 			<append> /\n\n:*:cmd_txt:\n/
 		#
 		#     write out the pre-mutilation text, with newlines
 		#
 		learn <:*:clf:> (:*:fileprefix::*:nonspamcss:) [:text:] /:*:lcr:/
 		call /:mungmail_add:/ [X-CRM114-Action: LEARNED NONSPAM]
                 call /:mungmail_unique:/ [X-CRM114-Status: Good (Learn)]
-                accept
-                exit /:*:accepted_mail_exit_code:/

 		accept
 		exit /:*:accepted_mail_exit_code:/
 	}
 	alius
 	{
@@ -725,13 +695,14 @@
 	    #    Verify that we need to learn this first (TOE strategy)
 	    classify <:*:clf:> [:text:] /:*:lcr:/ \
 		    (:*:fileprefix::*:spamcss: :*:fileprefix::*:nonspamcss: )\
 		    (:classify_status:)
 	    match [:classify_status:] <nomultiline> \
 		    /^#0.* pR: ([-. 0-9]+)/ (:: :pr:)
-	    eval /:@: :*:pr: < :*:thick_threshold: : /
+            # eval /:@: :*:pr: > (0 - :*:thick_threshold:) : /
+            eval /:@: :*:pr: > :*:spam_threshold: : /   # are we not
yet recognized as spam?
 	    #
 	    #     write out the pre-mutilation text, with newlines
 	    #
 	    output [:*:fileprefix:spamtext.txt] <append> /\n\n:*:cmd_txt: \n/
 	    learn < :*:clf:> (:*:fileprefix::*:spamcss:) [:text:] /:*:lcr:/
 	    call /:mungmail_add:/ [X-CRM114-Action: LEARNED SPAM]


-- 
Met vriendelijke groeten / Best regards,

Ger Hobbelt

--------------------------------------------------
web: http://www.hobbelt.com/
 http://www.hebbut.net/
mail: [email protected]
mobile: +31-6-11 120 978
--------------------------------------------------

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
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.