Updated for Naive Bayes, Kernel functions.