Naive bayesian method for classifying mnist database