A refactor of the Bayes class from the classifier gem, made to play nice with Rails.