[Spambayes] proposed changes to hammie & co.
Wed Nov 20 03:43:00 2002
>> I think we should take Bayes out of classifier and put it in Bayes.py
> 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.
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.
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
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.
More information about the Spambayes