[Spambayes-checkins] spambayes TestDriver.py,1.26,1.27

Tim Peters tim_one@users.sourceforge.net
Sat, 19 Oct 2002 22:19:50 -0700


Update of /cvsroot/spambayes/spambayes
In directory usw-pr-cvs1:/tmp/cvs-serv29514

Modified Files:
	TestDriver.py 
Log Message:
Added new Driver.set_classifier() method.  This is useful if you want to
run tests against a pre-existing classifier, as I've been doing in the
background on fresh python.org data.


Index: TestDriver.py
===================================================================
RCS file: /cvsroot/spambayes/spambayes/TestDriver.py,v
retrieving revision 1.26
retrieving revision 1.27
diff -C2 -d -r1.26 -r1.27
*** TestDriver.py	18 Oct 2002 05:44:05 -0000	1.26
--- TestDriver.py	20 Oct 2002 05:19:48 -0000	1.27
***************
*** 2,6 ****
  #     Optional:
  #         # Set up a new base classifier for testing.
! #         new_classifier()
  #     # Run tests against (possibly variants of) this classifier.
  #     Loop:
--- 2,6 ----
  #     Optional:
  #         # Set up a new base classifier for testing.
! #         new_classifier(), or set_classifier()
  #     # Run tests against (possibly variants of) this classifier.
  #     Loop:
***************
*** 136,141 ****
  
      def new_classifier(self):
!         c = self.classifier = classifier.Bayes()
!         self.tester = Tester.Test(c)
          self.trained_ham_hist = Hist()
          self.trained_spam_hist = Hist()
--- 136,146 ----
  
      def new_classifier(self):
!         """Create and use a new, virgin classifier."""
!         self.set_classifier(classifier.Bayes())
! 
!     def set_classifier(self, classifier):
!         """Specify a classifier to be used for further testing."""
!         self.classifier = classifier
!         self.tester = Tester.Test(classifier)
          self.trained_ham_hist = Hist()
          self.trained_spam_hist = Hist()