writing my own Naive Bayes' algorithm