Problem 1: Before the patient is given the test, the probability that they have the virus is 4%, P(virus)=4%=0.04. The accuracy of the test is test_accuracy=98%=0.98. We apply the formula from the medical test example:

Therefore, we have the following:


This means that there is a probability of about 67% that the patient has the virus, ...

Get Data Science Algorithms in a Week - Second Edition now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.