You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@spamassassin.apache.org by "Kevin A. McGrail" <ke...@thoughtworthy.com> on 2006/10/13 17:43:51 UTC

Meta Rules Weighting Question

I use Meta Rules with sub_tests such as:

body __RULE1 
body __RULE2

meta (__RULE1 + __RULE2) >= 1

Sometimes I want to change the weight from the default of 1.0 for the sub_tests.  I had *thought* this would work (but doesn't):

body __RULE1 
score __RULE1 0.5
body __RULE2
score __RULE2 0.5

meta (__RULE1 + __RULE2) >= 1

However, this does seem to work:

body __RULE1 
body __RULE2

meta ((__RULE1 + __RULE2) / 2) >= 1

Any comments or is this solution the "correct" way to do weighted sub_tests for a meta test?

Regards,
KAM

Re: Meta Rules Weighting Question [bug?]

Posted by Theo Van Dinter <fe...@apache.org>.
On Sun, Oct 15, 2006 at 10:01:27AM -0400, Kevin A. McGrail wrote:
> meta            KAM_TIME        ((__KAM_TIME1 + ((__KAM_TIME2 + __KAM_TIME3 
> + __KAM_TIME4 + __KAM_TIME5) / 2) + (__KAM_TIME6 * 1.5)) >= 2)
> 
> gives this error:
> 
> [1177] info: rules: meta test KAM_TIME has undefined dependency '1.5'
> 
> Would this be considered expected behavior and something I should add to 
> the wiki as well or would it be considered a bug?

I would consider that a bug.  Decimal numbers should work, not just integers.

-- 
Randomly Selected Tagline:
"Bender, I don't care whether you have money. I love you for your artificial
 intelligence and your sincerity simulator."
  -Countess de la Roca

Re: Meta Rules Weighting Question [bug?]

Posted by "Kevin A. McGrail" <ke...@thoughtworthy.com>.
I noticed when running in debug and testing the meta weighting we were 
discussing yesterday that running this test:

meta            KAM_TIME        ((__KAM_TIME1 + ((__KAM_TIME2 + __KAM_TIME3 
+ __KAM_TIME4 + __KAM_TIME5) / 2) + (__KAM_TIME6 * 1.5)) >= 2)

gives this error:

[1177] info: rules: meta test KAM_TIME has undefined dependency '1.5'

Changing to this works.

meta            KAM_TIME        ((__KAM_TIME1 + ((__KAM_TIME2 + __KAM_TIME3 
+ __KAM_TIME4 + __KAM_TIME5) / 2) + (__KAM_TIME6 * (3/2))) >= 2)

Would this be considered expected behavior and something I should add to the 
wiki as well or would it be considered a bug?

Regards,
KAM


Re: Meta Rules Weighting Question

Posted by Theo Van Dinter <fe...@apache.org>.
On Fri, Oct 13, 2006 at 11:43:51AM -0400, Kevin A. McGrail wrote:
> Sometimes I want to change the weight from the default of 1.0 for the sub_tests.  I had *thought* this would work (but doesn't):
> 
> body __RULE1 
> score __RULE1 0.5
> body __RULE2
> score __RULE2 0.5
> 
> meta (__RULE1 + __RULE2) >= 1
> 
> However, this does seem to work:
> 
> body __RULE1 
> body __RULE2
> 
> meta ((__RULE1 + __RULE2) / 2) >= 1
> 
> Any comments or is this solution the "correct" way to do weighted sub_tests for a meta test?

It looks like you think "__RULE1" in the meta rule is the rule's score, but
it's really a true/false (1/0) value for whether or not the rule hit.

If you want to weight your subrules differently, you can just apply weights to
them like you would in any standard equation:

meta ... (0.8 * __RULE1 + 0.5 * __RULE2 + ... ) > 1

or something like that.

-- 
Randomly Selected Tagline:
"These periods are always 15 minutes shorter than I'd like them, and 
 probably 15 minutes longer than you'd like them."   - Prof. Van Bluemel