[Spambayes] proposed changes to hammie & co.

Tim Stone - Four Stones Expressions tim@fourstonesExpressions.com
Wed Nov 20 04:39:19 2002


11/19/2002 9:43:00 PM, "Tim Peters" <tim_one@email.msn.com> wrote:

>[Tim Stone]
>>> I think we should take Bayes out of classifier and put it in Bayes.py
>
>[Neale Pickett]
>> Now that's downright heretical!  ;)  It makes sense, I think, Bayes.py
>> being where all the Bayes stuff hangs out.  But if you take WordInfo out
>> of classifier, and you take Bayes out of classifier, all you'll have
>> left is two constants.  Maybe you just want to rename classifier.py.  I
>> wonder what the other Tim thinks about this idea...
>
>Heresy is fine, but I don't understand what the goal of this is.

See below

>
>Jeremy previously added
>
>    WordInfoClass = WordInfo
>
>to the Bayes class so that subclasses (of Bayes) could specify the kind of
>WordInfo structure they want to use.  The methods in Bayes never call
>WordInfo directly, they always invoke self.WordInfoClass().  Bayes doesn't
>care, so long as whatever the WordInfoClass() factory returns supports the
>attributes the classifier accesses.

Looks like we've got an impedance mismatch here.  The WIDict class that Neale 
made always assumes WordInfo.  We'll have to fix that.  If Neale subclasses 
Pickle to do this, it'll still need to know what class to instantiate.  
Interesting.

>
>Subclassing is a clean & correct way to provide variants.  It's unfortunate
>that Bayes also became an old-style class for a different reason, as
>subclassing is much more efficient with new-style classes.  Then again,
>classifier methods aren't called that often, so it's hard to get excited
>about that.
>
>Taking the classifier class out of classifer.py doesn't make sense to me on
>the face of it, but maybe it would if I understood the goal.

I don't have strong feelings about it... we could just as easily put all the 
stuff that's in Bayes.py into classifier.py.  One file is better than two, at 
least in this instance.

>
>
>
- Tim
www.fourstonesExpressions.com 




More information about the Spambayes mailing list