[Spambayes-checkins] spambayes TestDriver.py,1.29,1.30

Rob W.W. Hooft hooft@users.sourceforge.net
Tue Nov 19 17:43:29 2002


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

Modified Files:
	TestDriver.py 
Log Message:
Some changes to enable the use of Delayed cost counters. It is a bit ugly to change the options on-the-fly, but OTOH: hey, this is a test driver!

Index: TestDriver.py
===================================================================
RCS file: /cvsroot/spambayes/spambayes/TestDriver.py,v
retrieving revision 1.29
retrieving revision 1.30
diff -C2 -d -r1.29 -r1.30
*** TestDriver.py	15 Nov 2002 21:32:19 -0000	1.29
--- TestDriver.py	19 Nov 2002 17:43:27 -0000	1.30
***************
*** 120,123 ****
--- 120,125 ----
                (num_unh + num_uns)*1e2 / (ham.n + spam.n))
  
+     return float(bests[0][0])/n,float(bests[0][1])/n
+ 
  def printmsg(msg, prob, clues):
      print msg.tag
***************
*** 190,195 ****
      def alldone(self):
          if options.show_histograms:
!             printhist("all runs:", self.global_ham_hist, self.global_spam_hist)
! 
          nham = self.global_ham_hist.n
          nspam = self.global_spam_hist.n
--- 192,201 ----
      def alldone(self):
          if options.show_histograms:
!             besthamcut,bestspamcut = printhist("all runs:", 
!                                                self.global_ham_hist, 
!                                                self.global_spam_hist)
!         else:
!             besthamcut = options.ham_cutoff
!             bestspamcut = options.spam_cutoff
          nham = self.global_ham_hist.n
          nspam = self.global_spam_hist.n
***************
*** 207,210 ****
--- 213,219 ----
                nfn * options.best_cutoff_fn_weight +
                nun * options.best_cutoff_unsure_weight)
+         # Set back the options for the delayed calculations in self.cc
+         options.ham_cutoff = besthamcut
+         options.spam_cutoff = bestspamcut
          print self.cc
  





More information about the Spambayes-checkins mailing list