Learning: Bayes' classifier Example: given a company where 70% of developers use Java and 30% use C++, and knowing that half of the Java developers always use enhanced for loop, if you look at the snippet: which is the probability that the developer who wrote it uses Java? for (int j=0; j<100; j++) { t = tests[j]; } P (A∣B )= P (B∣A)P (A) P (B ) Bayes' theorem Solution: A = developer uses Java B = developer writes old for loops P (A∣B)= P (B∣A)P (A) P (B) = 0.5⋅0.7 0.65 =0.54 P(A) = prob. that a developer uses Java = 0.7 P(B) = prob. that any developer uses old for loop = 0.3 + 0.7*0.5 = 0.65 P(B|A) = prob. that a Java developer uses old for loop = 0.5