[Spambayes-checkins] spambayes/testtools regimes.py,1.1,1.2 timcv.py,1.2,1.3

T. Alexander Popiel popiel at users.sourceforge.net
Fri Mar 7 16:33:26 EST 2003


Update of /cvsroot/spambayes/spambayes/testtools
In directory sc8-pr-cvs1:/tmp/cvs-serv5750

Modified Files:
	regimes.py timcv.py 
Log Message:
Adding another regime, mangling python path at the top of timcv.py
to make it easier for those of us without spambayes on the pythonpath...




Index: regimes.py
===================================================================
RCS file: /cvsroot/spambayes/spambayes/testtools/regimes.py,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** regimes.py	28 Feb 2003 17:35:29 -0000	1.1
--- regimes.py	8 Mar 2003 00:33:22 -0000	1.2
***************
*** 83,84 ****
--- 83,111 ----
              return actual
          return 0
+ 
+ ###
+ ### This is a training regime for the incremental.py harness.
+ ### It does guess-based training on all messages, followed by
+ ### correction to perfect at the end of each group.
+ ###
+ 
+ class expire4months:
+     def __init__(self):
+         self.ham = [[]]
+         self.spam = [[]]
+ 
+     def group_action(self, which, test):
+         if len(self.ham) >= 120:
+             test.untrain(self.ham[119], self.spam[119])
+             self.ham = self.ham[:119]
+             self.spam = self.spam[:119]
+         self.ham.insert(-1, [])
+         self.spam.insert(-1, [])
+ 
+     def guess_action(self, which, test, guess, actual, msg):
+         if actual < 0:
+             self.spam[0].append(msg)
+         else:
+             self.ham[0].append(msg)
+         return actual
+ 

Index: timcv.py
===================================================================
RCS file: /cvsroot/spambayes/spambayes/testtools/timcv.py,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** timcv.py	17 Jan 2003 06:42:54 -0000	1.2
--- timcv.py	8 Mar 2003 00:33:23 -0000	1.3
***************
*** 49,53 ****
--- 49,58 ----
  from __future__ import generators
  
+ import os
  import sys
+ 
+ sys.path.insert(-1, os.getcwd())
+ sys.path.insert(-1, os.path.dirname(os.getcwd()))
+ 
  
  from spambayes.Options import options





More information about the Spambayes-checkins mailing list