I’ve been trying to put together a Bayesian classifier in JavaScript, mostly for spam filtering purposes. It didn’t turn out very well. So, I Googled for such a thing and found this: http://www.onemanclapping.org/2008/10/bayes-filtering-in-javascript.html. It looks very well done and I’d recommend it (from the brief testing I’ve done with it), although I’d like to point out that the code is not very portable. Luckily, according to the author’s website, http://www.dusbabek.org/~garyd/, the project is public domain. My plan is to make the code into a fully portable library, and then repost it for all to use. Stay tuned; I will post it soon!