Ask/Poll News.YC: What is a good open source Bayes classifier?
I'm just doing a little research for a project and I thought everybody could benefit from the fact that we have happen to have an expert on the subject as a member.
I would also like learn from what other people have used as well so any input that others could give would be helpful.
------------
UPDATE: I started a poll thread below so that we can submit a project link and up-vote a link if we have experience or knowledge over one project versus another.
Thank you to everybody who replied, you are great!!!
40 comments
[ 5.1 ms ] story [ 86.7 ms ] threadThere are quite a lot of toolkits out there that do Bayesian things (take a look at libbow or Weka).
It's only for text processing.
For example, if you live in a world with only black and white birds, but you don't know the percentage of each and have no reason to believe it's more likely 2% black than 70% black, or any other percentage, if you see two black birds fly by, that doesn't mean the next bird you see has a 100% probability of being black, but that's exactly the assumption most widely-used naive Bayesian classifiers make.
I modified SpamProbe to use (spam+1)/(total+2), and the results have been good.
All due credit to Laplace for the technique, but the word "smoothing" is making me wince, because it makes it sound as though this is some artificial approximation. For the assumption of an even distribution of probabilities, n+1 / m+2 really _is_ the exact probability of the event repeating. Like I said, you can confirm this experimentally with a quick program.
This is important, because while adding a single pseudocount to each column will prevent zero divisions, it's probably not reflective of the true distribution of values. If instead, you add pseudocounts using a Dirichlet where the parameters are set based on some prior knowledge, you can often improve the performance of the classifier (especially in low-count situations), without biasing the results unfairly.
This is a simple one built in C#/.Net. I fixed a significant bug and raised classification accuracy from 74% -> 96% in my noisy dataset (automobile accident claims). I emailed the author with a bunch of improvements (such as histograms) and some other tweaks but never heard back. Anyway, the bugfix is simple: take a look at category.cs. In TeachPhrase(), move m_TotalWords++ inside the test for "if (!m_Phrases.TryGetValue(phrase, out pc))".
What you want here is to count the # of unique words. The original code was counting the total # of times all words appear.This one change reduced classification errors by 3X.
Cheers, --Jack
Very high quality. Multiple people have used it for serious research.
reply only to this message and vote on links below
http://classifier.rubyforge.org/
http://jbnc.sourceforge.net/
http://crm114.sourceforge.net/
If you want to get more serious, use Weka or Bow or YALE or something implemented in a reasonably fast language.
No doubt, I'll be combing through all of the CRM114 information on the website. Is there anything that is not referenced there that will be of use?
learn ham.css < file_to_learn.txt
learn spam.css < file_to_learn.txt
classify < file_to_classify.txt
It's not just a Bayes classifier. It's got every machine learning algorithm you can think of. Once you get the file format right, you can drop-in any algorithm you want. It's amazing.
Weka is written in Java and implements all kinds of machine learning/data mining tools.
http://crm114.sourceforge.net/
Seriously though this is exactly what I need to accomplish my tasks (which is not SPAM filtering). I briefly looked at all of the other alternatives before diving deeper into the "CRM114 Revealed" book. I really wish I knew about this a few years earlier!!
It is written in combination of Python and C. It can be used as a python module.
http://crf.sourceforge.net/
Its extremely well written, easy to define features etc. Reasonably good support too.