# How to calculate the probability that a scalar data point maps to a class?

Suppose that I have the following data set that maps students' test score to the class in which the student belongs:

DADA Test Score | Class
--------------- | -----------
9.5             | Gryffindor
8.4             | Hufflepuff
7.5             | Gryffindor
7.8             | Slytherin
8.2             | Ravenclaw

... and so on

Knowing this data, is it possible to calculate the probability that an unknown student belongs to a specific class, given her test score?

Without assumptions, the probability that a score of 9.2 belongs to Gryffindor is simply:

Prob(9.2) = (# of students in Gryffindor with 9.2) / (Total # of students in Gryffindor)

However, in practice, you should probably look at the data over all classes and figure out if it fits a well-known probability distribution.

For example, assume the probability distribution of score to be normal with possibly different mean and variance per class. You can then estimate the mean and variance per class from sample data, and the probability is straight forward.

For instance, suppose Gryffindor has a mean of 8.0 and variance of 2.0. Then the probability that a score of 9.2 belongs to Gryffindor is the probability that the score is in the range [9.15, 9.25), so:

Z1 ~= (9.15 - 8.0)/2.0 = 0.575
Z2 ~= (9.2499 - 8.0)/2.0 = 0.62495
Prob(9.2) ~= N(X>Z1) - N(X>Z2) ~= **0.016666**
• How did you decide to add and subtract 0.05 from 9.2? Aug 17, 2018 at 17:48