The Bayes theorem

In order to understand the Bayes theorem first, before we attempt to take a look at the Naïve Bayes classification method, we should consider this example. Let's assume that among all the people in the U universe, the set of people who have breast cancer is set A, and set B is the set of people who had a screening test and were unfortunately diagnosed with the result positive for breast cancer. This is shown as the overlap region A∩B in the following diagram:

The Bayes theorem

There are two unusual areas that need focus: B – A∩B or people without breast cancer and with a positive test on diagnosis and the event A – A∩B or people with breast cancer and with a negative test on diagnosis. Now, let's attempt to answer whether we know that the test is positive for a randomly selected person. Then, what is the probability that the person has breast cancer? This visually translates to whether we know that a person is visible in the B area, then what is the probability that the same person appears in A∩B? Mathematically, this translates to what is probability (A given B). Conditional probability equation is shown here:

The Bayes theorem

Similarly, if we know that a randomly selected person has cancer, what is the probability that the diagnosis test came out positive? This translates to probability (B given A), as shown in the following code:

The Bayes theorem

Thus, we derive at the Bayes theorem, where A and B are events with P (B) nonzero.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset