Python implementation of Bayes classification algorithm