The implementation of NaiveBayes algorithm.