Implementation of the Naive Bayes Algorithm for classifying data