new naive bayes implementation