Naive Bayes implementation with digit recognition sample