[Spambayes] Re: [Spambayes-checkins] spambayes classifier.py,1.53.2.6,1.53.2.7

T. Alexander Popiel popiel@wolfskeep.com
Fri Nov 22 19:16:02 2002


In message:  <w53wun5v3np.fsf@woozle.org>
             Neale Pickett <neale@woozle.org> writes:
>
>What do you think of this idea:
>
>probcache is kept as a property of Classifier.  Make a
>classifier.probability(self, word) method which looks up that word's
>(spamcount, hamcount) tuple in probcache.  If it's not there, compute it
>and add it.  Whenever Classifier.learn or Classifier.unlearn are called,
>probcache is blown away.
>
>This will effectively cache probabilities on demand, and make sure they
>are current.  No need for a revision anymore.
>
>Sound good?

Sounds good to me.  If you split the probability computation itself
into a separate method from the cache management stuff, then it makes
it easier to subclass to replace just the counts->probability formula.

- Alex



More information about the Spambayes mailing list