Bug in tuning.sh?

Greg Louis glouis at dynamicro.on.ca
Thu Jun 12 18:59:50 CEST 2003


On 20030612 (Thu) at 1812:23 +0200, Boris 'pi' Piwinger wrote:
> Greg Louis <glouis at dynamicro.on.ca> wrote:
> 
> >> getco $md 0.10 $rs r0.ns.mc r1.ns.mc r2.ns.mc
> >
> >Good catch.  That should be
> >getco $md,$rs 0.1 r0.ns.mc r1.ns.mc r2.ns.mc
> >with current bogofilter.
> 
> Great. I knew something was wrong. With my fixed explained
> below my tuning results now are really showing something:
> 
> >06/12 17:42:03 3.2e-2 0.450 fpos.. 0 at cutoff 0.797000, run0.. 111  run1.. 100  run2.. 103  314
> >06/12 17:29:34 1e-1   0.450 fpos.. 0 at cutoff 0.797000, run0.. 125  run1.. 113  run2.. 116  354
> >06/12 17:54:31 1e-2   0.450 fpos.. 0 at cutoff 0.797000, run0.. 132  run1.. 106  run2.. 120  358
> >06/12 17:17:06 3.2e-1 0.450 fpos.. 0 at cutoff 0.797000, run0.. 132  run1.. 116  run2.. 124  372
> >06/12 17:04:38 1      0.450 fpos.. 0 at cutoff 0.797000, run0.. 147  run1.. 133  run2.. 149  429
> >06/12 17:28:55 1e-1   0.425 fpos.. 0 at cutoff 0.946100, run0.. 162  run1.. 146  run2.. 154  462
> >06/12 17:41:24 3.2e-2 0.425 fpos.. 0 at cutoff 0.946100, run0.. 178  run1.. 154  run2.. 166  498
> >06/12 17:53:52 1e-2   0.425 fpos.. 0 at cutoff 0.946100, run0.. 188  run1.. 165  run2.. 173  526
> >06/12 17:16:26 3.2e-1 0.425 fpos.. 0 at cutoff 0.946100, run0.. 184  run1.. 177  run2.. 174  535
> >06/12 17:28:16 1e-1   0.400 fpos.. 0 at cutoff 0.962300, run0.. 175  run1.. 186  run2.. 181  542
> 
> What we do see: robs is significant no:-)) What is still
> strange: the cutoff which is displayed is not affected,
> which I cannot believe. So there will be something else
> wrong.

There is.  (I wrote to you off list about this, inadvertently; in that
message I said I didn't have time today to go into it, but then I snuck
a couple of minutes anyway ;)

Try this:

--- tuning.sh.orig	2003-06-12 12:45:04.000000000 -0400
+++ tuning.sh	2003-06-12 12:54:59.000000000 -0400
@@ -70,15 +70,15 @@
 fi
 
 function getco () {
-    opts="-m$1 -o$2"
+    opts="-m$1 -o$2"; tgt=$3
     shift ; shift ; shift
     res=`cat $* | bogofilter -t -c $CFG $opts -v 2>&1 | \
-    perl -e ' $target = $ENV{"target"}; while (<>) { ' \
+    perl -e ' $target = shift at ARGV; while (<>) { ' \
 	 -e ' ($i, $d) = split; push @diffs, $d unless $i != 1; }' \
 	 -e ' die "dainbramage" unless scalar @diffs > 15;' \
          -e ' @s = sort { $a <=> $b } (@diffs); $co = $s[$target];' \
 	 -e ' while($co < 0.000001) { ++$target; $co = $s[$target]; }' \
-	 -e ' printf("%8.6f %d",1.0-$s[$target],$target-1);'`
+	 -e ' printf("%8.6f %d",1.0-$s[$target],$target);' $tgt`
 }
 
 function wrapper () {
@@ -94,7 +94,7 @@
     date=`date "+%m/%d %H:%M:%S"`
     echo -n $date "  "
     printf "%-7s %5.3f fpos..." $rs $md
-    getco $md 0.10 $rs r0.ns.mc r1.ns.mc r2.ns.mc
+    getco $md,$rs 0.10 $target r0.ns.mc r1.ns.mc r2.ns.mc
     fpos=${res##* }; co=${res%% *}; let fpos=$fpos/3
     printf "%d at cutoff %8.6f, run0..." $fpos $co
     run=0; wrapper $md $co $rs r0.sp.mc; fneg1=$res

I don't think the $ENV call in the original was working, and I've used
the @ARGV approach successfully myself.  This patch is untested but it
ought to work :)

-- 
| G r e g  L o u i s          | gpg public key: finger     |
|   http://www.bgl.nu/~glouis |   glouis at consultronics.com |
| http://wecanstopspam.org in signatures fights junk email |




More information about the Bogofilter mailing list