Writing Naive Bayes