Naive Bayes implementation.