I’m writing this mostly as a reminder to myself - it would be interesting to use a Bayesian filtering approach to analyze the content of a blog entry to aid in auto-categorization of the content.
I’d be interested if others have thought about this approach to reduce the amount of friction involved in categorizing blog entries (or other types of free-form content for that matter).
13 archived reader comments
Jeff Atwood (2004-11-05)
The LinkTron 5000 can sorta-kinda do this.
http://www.codinghorror.com/linktron5k/
It builds a unique google search string for any given content page, based on how unique google thinks the words in the page are. I have some experimental code that extends this logic to repeated phrases in the page too, but I haven’t exposed it yet (uh, this is hard?)
And, obviously, behind the scenes I am using a giant dictionary table consisting of abusively (one time!) preloaded Google queries for each word in the English dictionary.
However, automatic *categorization* based on terms — at first glance, that seems to me like one of those insoluble lead to gold computing problems. Would be nice though.
Gordon Weakliem (2004-11-05)
Have a look at Reverend (http://www.divmod.org/Home/Projects/Reverend/), which is a Bayesian classifier for Python. The thing with Bayes is that it’s a binary decision, which is why it’s perfect for Spam classification; your decision is spam/not spam. For general classification, I think you’d end up with something like a tree or a chain of filters. The other thing is that you’d need to know your categories ahead of time, because Bayesian classification needs to have buckets. It sounds like Jeff is talking about dynamic categorization, which is a more interesting problem. Maybe a word frequency count on your posts would help to determine a good set of categories.
casey chesnut (2004-11-05)
this has been done using a Self Organizing Map (SOM) neural network. do a search for WebSOM. it 1st ogranizes similar words, and then matches newsgroups or websites to those words. could also be applied to blogs. i recently applied this technique to organizing images (http://www.brains-N-brawn.com/aiSomPic). it just clusters them for visualization and searching though, but not for classification
Shital Shah (2004-11-05)
You might want to check out http://nclassifier.sourceforge.net/
Eric (2004-11-05)
I think it’d depend on how differentiated the entries that’d constitute each category would be. You’d probably get a lot more accuracy out of trying to separate say programming entries from entries about politics. If your topics are more similar to each other, say Python vs. Java programmming, your accuracy will probably go down because the number of words than can act as strong discriminators between the categories goes down.
Since you’d probably want to seed the learner with some trained examples first, you’d probably get the most bang for your buck in terms of effort & results using a Naive Bayes classifier instead of any of the other more exotic techniques (SVMs, boosting, etc…). Multi-class text classification (i.e. using the same learner to learn how to classify a blog entry between multiple categories) can be done using Naive Bayes- there’s no restriction that keeps it to binary classification.
Larry O’Brien (2004-11-05)
Jon Udell’s mentioned it:
http://www.xml.com/pub/a/2003/11/19/udell.html
It seems clearly do-able, given a decent Bayesian library and corpus.
Not the same Eric as the guy right above me (2004-11-05)
I’m working (in my vanishingly small spare time) on an application that will include autocategorization of arbitrary content; one design goal is to produce a tool my wife (a Ph.D. candidate) can use to easily organize notes, quotes, references, etc and other information while writing papers (and eventually her dissertation).
Ironically, I wrote my own .Net port of Classifier4J before nClassifier went up on SourceForge. :-P
Eric Yeh (2004-11-05)
(sorry about the vague labelling Eric, I added my last name to this post to clarify)
One suggestion I’ve heard in regards to text categorization is to use hand crafted rules first, and when you’ve got a sufficiently large training set, switch over to a learner (i.e. Naive Bayes, etc). From what I understand, you’d need a lot of training instances before you can get what’d be deemed as good accuracy.
I’ve heard there are techniques out there, such as using term frequencies and various statistical tests, that can discover words/terms that are especially telling when it comes to separating categories (i.e. good discriminators). Search engines use a “tf/idf” weighting scheme (http://phpwiki.sourceforge.net/phpwiki/TfIdfRanking), to determine how important a term is for describing a document, so maybe that might be an interesting thing to try.
Andrey Cherezov (2004-11-06)
PopFile (Bayesian email classifier written in Perl) - http://popfile.sourceforge.net/ - have a XML-RPC iterface to its classifier, so it is very easy to connect it to a blog software to classify blog posts just like any email.
Barry Gervin (2004-11-06)
probably worth looking at some of the named entity extraction algorithms. Some open source tools there. http://threattracker.com:8080/lingpipe-demo/demo.html
Next time over a beer, ask me about sonicboomerang.
Wayne Allen (2004-11-06)
I’ve been playing with using latent semantic indexing/analysis (LSI/LSA) to do this kind of thing. Better in my mind than Bayesian since it extracts meaning from the content itself so you don’t need a starting corpus.
John Lam (2004-11-08)
Thanks everyone for forwarding these links - there’s lots of interesting stuff there. I’ll summarize some of my findings in a future blog.
Thomas Freudenberg (2004-11-10)
Gosh, I’ve just started a couple of days ago implementing Bayesian categorization in RSS Bandit. Well, I think it will take several weeks, since I’ve not as much time as I’d like to.