From: Ken Bloom Date: 2007-02-07T00:10:11+09:00 Subject: Re: Classifier::Bayes - handling "none of the above" cases On Tue, 06 Feb 2007 07:38:00 +0900, Jason Frankovitz wrote: > I'm using Classifier::Bayes and am trying to figure out how to handle > classifications that don't fit any of my categories. It seems that it > will guess a category no matter how poor the match. Is there a good way > to use the hash values from #classify() to "figure out" how bad a match > is? I'd like to handle those cases as a "none of the above". This isn't > the greatest example but hopefully it'll work well enough: > > Imagine three categories (shopping, health, and technology) and I want > to classify the text "cows dirt barn". Obviously, those words aren't a > good fit for any of the three. What I want is a way to determine how bad > an attemped classification is, and react to it. I was thinking maybe a > catch-all, "empty" category could handle this? Wouldn't it be nice? Unfortunately for you, a bayesian classifier (and most other classification algorithms) require examples for every class that it could possibly categorize. The classifier just chooses the most like class from what it's been trained on. If you wanted a "none of the above" class, then you'd need to provide examples from that none of the above class. It's not so easy to decide what's representative of "none of the above", and even if you could do so, it would probably violate the assumptions of the classifier and lead to reduced performance. Thus, we have to come up with more creative problem-specific solutions to handle something resembling a "none-of-the-above" case, usually solutions that change the definition of the problem quite dramatically. --Ken -- Ken Bloom. PhD candidate. Linguistic Cognition Laboratory. Department of Computer Science. Illinois Institute of Technology. http://www.iit.edu/~kbloom1/