Naive Bayes algorithm example implementation