Re: 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]> |
BZZZZZZT!
Bill was smarter than me, but not enough. He swapped spam.css and
nonspam.css for that training's classify pre-check, at least that's
sure been the intent. #1 is not an error...
BUT... riddle me this:
just above that line it says (and read VERY carefully):
classify <:*:clf:> [:text:] /:*:lcr:/ \
(:*:fileprefix::*:spamcss: :*:fileprefix::*:nonspamcss: )\
(:classify_status:)
See what is missing? The '|' pipe symbol!
And unless I am VERY wrong (and I got my mouth and foot ready to plant
in former...), this will significantly b0rk attempts to train in a
non-cache environment as the classify joins both CSS files on a single
side.
Wrong? Or Right?
Despite the hour (~ 6 AM) my guess is I've hit paydirt, so I kicked
out the minor smartness (no more css swap in classify) and then the
fix for #1 is this:
(yes, the pipe symbol is /consistently/ lacking in mailfilter.crm in
the non-cached learn situations...)
@@ -619,31 +831,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: ) \
+ (:*: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 'thick_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
{
@@ -721,17 +941,18 @@
}
{
# Not cached...
#
# Verify that we need to learn this first (TOE strategy)
classify <:*:clf:> [:text:] /:*:lcr:/ \
- (:*:fileprefix::*:spamcss: :*:fileprefix::*:nonspamcss: )\
+ (:*:fileprefix::*:nonspamcss: |
:*:fileprefix::*:spamcss: )\
(: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]
Conclusion:
a) I should clean my glasses and maybe splurge on reading lessons
because I apparently can't do code reviews anymore.
b) we, ah, um, might benefit from an extended test suite.
(And in case anyone is wondering: why am I seeing the same issue (pipe
missing in classify) in mailreaver @ 542 and no!body gets hurt? :-S
:-S :-S
I must've forgotten to pay the brain bill, 'cause they sure as Hell
have disconnected *me*, as I can't see how that ever would have worked
out well given OSB et al, as the '|' pipe (vbar_seen) is used to
determine which CSS files are 'left' and which are 'right' (succhash
variable in most prod classifier C code) and that should have had some
serious effect on the pR output, shouldn't it?)
On Sun, Sep 28, 2008 at 11:17 PM, Ger Hobbelt <[email protected]> wrote:
> 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
> --------------------------------------------------
>
--
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=/