final version of naive bayes