This is a simple Naive Bayes Classifier based on Bayes theorem and is a fundamental classification method in Machine Learning (Supervised Learning).
More details about Naive Bayes can be found here: https://en.wikipedia.org/wiki/Naive_Bayes_classifier and http://software.ucv.ro/~cmihaescu/ro/teaching/AIR/docs/Lab4-NaiveBayes.pdf