Introduction to Data Mining

<<< Previous    Up    Next >>>

Lesson 5

Bayes' Rule

 

    Consider two events A and E. We can write A as the union of two mutually exclusive events, (E ∩ A) and (E' ∩ A). Hence A = (E ∩ A) U (E' ∩ A).

By the property of mutually exclusive events,

P(A) = P[(E ∩ A) U (E' ∩ A)]

        = P(E ∩ A) + P(E' ∩ A)   

        = P(E).P(A/E) + P(E').P(A/E')                                        ..... by definition of conditional probability

 

Now the above can be extended if the events B1, B2,......,Bk constitute a partition of the sample space, S such that P(Bi) ≠ 0, then for any event A (shown in yellow) of S, we have

  P(A) = åi=1[P(Bi ∩ A)]åi=1[P(Bi) . P(A/Bi)]

Example: In a certain assembly plant, three machines B1, B2 and B3 make 30%, 45% and 25% of the products, respectively. About 2%, 3% and 2% of the products made by each machine, respectively, are defective. Now if a finished product is selected randomly, what is the probability that it is defective?

Answer: Let event A = the product selected is defective.

              Let B1= the product was made by machine B1.

              Let B2= the product was made by machine B2.

              Let B3= the product was made by machine B3.

So we have P(A) = P(B1).P(A/B1) + P(B2).P(A/B2) + P(B3).P(A/B3)

                            = (0.3)(0.02) + (0.45)(0.03) + (0.25)(0.02)

                            = 0.006 + 0.0135 + 0.005

                            = 0.0245

 

Now if we wish to find the conditional P(B1/A) in the above example, i.e. given that the product selected is defective, which one of the machines made it. This can be found by using the Bayes' rule.

Bayes' Rule: If the events B1, B2,......,Bk constitute a partition of the sample space, S such that P(Bi) ≠ 0, then for any event A of S, such that P(A) ≠ 0,

 P(Br/A) =        P(Br ∩ A)           =         P(Br).P(A/Br)                       ... for r = 1 to k

           åi=1[P(Bi ∩ A)]      åi=1[P(Br).P(A/Br)]

Example: If for the above problem, the product chosen randomly was found to be defective, what is the probability that it was made by machine B3?

Answer:  P(B3/A) =  [P(B3).P(A/B3)] / [  P(B1).P(A/B1) + P(B2).P(A/B2) + P(B3).P(A/B3) ]

                            = [(0.25)(0.02)] / [ (0.3)(0.02) + (0.45)(0.03) + (0.25)(0.02) ]

                            = 0.005 / 0.0245

                            = 0.2041

 

Exercises:

  1. A regional telephone company operates three identical relay stations, A B C at different locations. During one year the problems reported by each station along with their causes is shown below.

  A B C
Problems with electricity supply 2 4 1
Computer malfunction 7 3 2
Malfunctioning electrical equipment 1 4 4
Caused by human errors 7 5 6

        If a malfunction caused by human error is reported, find the probability that it came from station C.

 

  1. The city police enforce speed limits by using radar traps at 4 different locations, L1 L2 L3 and L4. They are operated 40%, 30% , 20% and 10% of the time, respectively. If a speeding person, who has a probability of 0.2, 0.3, 0.1, and 0.4 of passing through these locations, what is the probability that he will receive a ticket? Given that he has got a ticket, what is the most probable location where he was caught speeding? 

 

<<< Previous    Up    Next >>>