Unfolding Naive Bayes From Scratch