1
$\begingroup$

I am currently attending a machine learning course and we are reviewing some probability theory which is of course fundamental for machine learning.

Suppose you are working at a library. Some students have stolen books from the library $\mathbf{P}(E=thief)= 1/3$ therefore we have also $\mathbf{P}(\overline{E}= no \ thief) = 2/3$

To detect those stealing students you are using a lie detector. The probability that a student passes the test if he is guilty is 1/6.

The student passes the detector also if he isn't guilty with 5/6

Now I want to use Bayes rule to determine the probability that a student is guilty given that he fails the detector.

All the probabilities we have

$\mathbf{P}(E=thief)= 1/3$ $\mathbf{P}(\overline{E}= no \ thief) = 2/3$

$\mathbf{P}(+|E) = 1/6 $ $\mathbf{P}(-|E) = 5/6$

$\mathbf{P}(+|\overline{E}) = 5/6$ $\mathbf{P}(-|\overline{E}) = 1/6$

where + means passing the test and - failing the test.

The prob. which want to know is

$$\mathbf{P}(E|-)=\frac{\mathbf{P}(-|E)\mathbf{P}(E)}{\mathbf{P}(-|E)\mathbf{P}(E)+\mathbf{P}(-|\overline{E})\mathbf{P}(\overline{E})}$$

plugging in the values gives us

$$\mathbf{P}(E|-)=\frac{\frac{5}{6}\cdot \frac{1}{3}}{\frac{5}{6} \cdot \frac{1}{3}+\frac{1}{6} \cdot \frac{1}{6}}=0.714$$

Did I follow Bayes' rule correctly because I am not sure if the statement "The probability that a student passes the test if he is guilty is 1/6." has to be $\mathbf{P}(+ \cap E)= \frac{1}{6}$ or $\mathbf{P}(+|E)= \frac{1}{6}$

$\endgroup$
2
  • $\begingroup$ It $\mathbf{P}(+|E)= \frac{1}{6}$ The former probability $\mathbf{P}(+ \cap E)$ is the probability that if we pick a student at random, he is the thief, and passes the lie detector test. There is no way to compute this from the given data. We don't even know how many students there are. Your formula looks right. I haven't checked the substitutions or arithmetic. $\endgroup$
    – saulspatz
    Oct 24, 2018 at 15:50
  • $\begingroup$ take a look at the final expression, the denominator should be the $P(-)$, which is basically: $P(-|E)*P(E)+P(-|E_{bar})*P(E_{bar})= \frac{5}6*\frac{2}3+\frac{1}6*\frac{2}3$ $\endgroup$
    – Chaos
    Oct 24, 2018 at 16:20

1 Answer 1

1
$\begingroup$

Your calculation and your result is correct. Usually I use a table to maintain an overview.

$$\begin{array}{c|c|c|c} & E&\overline E \\ \hline - & \frac{5}{18} &\frac{2}{18} &\frac{7}{18}\\ \hline +&\frac{1}{18} &\frac{10}{18} & \frac{11}{18}\\ \hline &\frac{6}{18} &\frac{12 }{18}&1 \\ \end{array}$$

The required probability can be read off the table:

$$P(E|-)=\large{\frac{\frac{5}{18}}{\frac{7}{18}}}\normalsize =\frac57\approx 0.714$$


$\mathbf{P}(+|E)= \frac{1}{6}$ is the right one.

I´ve noticed that you have a typo (red marked): $$\frac{\frac{5}{6}\cdot \frac{1}{3}}{\frac{5}{6} \cdot \frac{1}{3}+\frac{1}{6} \cdot \color{red}{\frac{2}{3}}}$$

$\endgroup$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .