From: Matt Mower Date: 2005-04-15T16:56:45+09:00 Subject: [ANN] Bishop 0.3.0 - bayesian classifier for Ruby ported from Python Hi folks, I've recently released a Ruby port "Bishop" of the "Reverend" bayesian classifier written in Python. Bishop-0.3.0 is available as a Gem and from RubyForge http://rubyforge.org/projects/bishop/ Bishop is a reasonably direct port of the original Python code, bug reports and suggestions for improving the structure of the code would be welcomed. Bishop includes both Robinson and Robinson-Fisher algorithms for classification. It is presumed that they were correctly implemented in Reverend. I aim to test this in my own use of the code. Support is included for saving/loading the trained classifier to/from YAML. An example of using Bishop: require 'bishop' b = Bishop::Bayes.new b.train( "ham", "a great message from a close friend" ) b.train( "spam", "buy viagra here" ) puts b.guess( "would a friend send you a viagra advert?" ) => [ [ "ham", ], [ "spam", ] ] Bishop defaults to using the Robinson algorithm. To use a different algorithm construct the classifier passing a block which will call the choosen algorithm: Bishop::Bayes.new { |probs,ignore| Bishop::robinson_fisher( probs, ignore ) } To save to a YAML file: b.save "myclassifier.yaml" To load from a YAML file: b.load "myclassifier.yaml" You can uniquely identify training items b.train( "ham", "friends don't let friends develop on shared hosting", "" ) An can untrain items: b.untrain( , [, ] ) I'm using this in a project of my own and would welcome any feedback or suggested improvements. Regards, Matt -- Matt Mower :: http://matt.blogs.it/