How it works
As an example, suppose we have the following (binary) feature values from a sample in our dataset: [0, 0, 0, 1].
Our training dataset contains two classes with 75 percent of samples belonging to the class 0, and 25 percent belonging to the class 1. The likelihood of the feature values for each class are as follows:
For class 0: [0.3, 0.4, 0.4, 0.7]
For class 1: [0.7, 0.3, 0.4, 0.9]
These values are to be interpreted as: for feature 1, it has a value of 1 in 30 percent of cases for samples with class 0. It is a value of 1 in 70 percent of samples with class 1.
We can now compute the probability that this sample should belong to the class 0. P(C=0) = 0.75 which is the probability that the class is 0. Again, P(D) isn't needed for ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access