Training a Naive Bayes classifier