Naive Bayes classifier code