Presentation is loading. Please wait.

Presentation is loading. Please wait.

COMP61011 : Machine Learning Probabilistic Models + Bayes’ Theorem

Similar presentations


Presentation on theme: "COMP61011 : Machine Learning Probabilistic Models + Bayes’ Theorem"— Presentation transcript:

1 COMP61011 : Machine Learning Probabilistic Models + Bayes’ Theorem

2 Probabilistic Models one of the most active areas of ML research in last 15 years foundation of numerous new technologies enables decision-making under uncertainty Tough. Don’t expect to get this immediately. It takes time.

3 I have four snooker balls in a bag – 2 black, 2 white.
I reach in with my eyes closed. What is the probability of picking a black ball? I give this variable a name, “A”.

4 Picking a black ball, then replacing, then picking black again?
Why?

5 Picking two black balls in sequence (i.e. no replacing) ?

6 Probabilities and Conditional Probabilities
Events : A, B, C, etc – “random variables” e.g. A is the random “event” of picking the first ball. B is the random “event” of picking the second ball. where ‘1’ means the ball was black.

7 the second is black, given that
Rules of Probability Theory Probability that the second is black, given that the first was black Probability that both balls are black = Probability that the first is black x

8 Shorthand notation Means that the rule holds for all possible assignments of values to A and B.

9 If two events A,B are dependent :
e.g. black/white balls example If two events A,B are independent : e.g. two consecutive rolls of a dice

10 The chances of the wind being strong, among all days.
Outlook Temperature Humidity Wind Tennis? D1 Sunny Hot High Weak No D2 Strong D3 Overcast Yes D4 Rain Mild D5 Cool Normal D6 D7 D8 D9 D10 D11 D12 D13 D14 The chances of the wind being strong, among all days.

11 The chances of the wind being strong, among all days.
Outlook Temperature Humidity Wind Tennis? D1 Sunny Hot High Weak No D2 Strong D3 Overcast Yes D4 Rain Mild D5 Cool Normal D6 D7 D8 D9 D10 D11 D12 D13 D14 The chances of the wind being strong, among all days.

12 Outlook Temperature Humidity Wind Tennis? D1 Sunny Hot High Weak No D2 Strong D3 Overcast Yes D4 Rain Mild D5 Cool Normal D6 D7 D8 D9 D10 D11 D12 D13 D14 The chances of a strong wind day, given that the person enjoyed tennis.

13 Outlook Temperature Humidity Wind Tennis? D3 Overcast Hot High Weak Yes D4 Rain Mild D5 Cool Normal D7 Strong D9 Sunny D10 D11 D12 D13 The chances of a strong wind day, given that the person enjoyed tennis.

14 Outlook Temperature Humidity Wind Tennis? D3 Overcast Hot High Weak Yes D4 Rain Mild D5 Cool Normal D7 Strong D9 Sunny D10 D11 D12 D13 The chances of a strong wind day, given that the person enjoyed tennis.

15 Outlook Temperature Humidity Wind Tennis? D1 Sunny Hot High Weak No D2 Strong D3 Overcast Yes D4 Rain Mild D5 Cool Normal D6 D7 D8 D9 D10 D11 D12 D13 D14 The chances of the person enjoying tennis, given that it is a strong wind day.

16 Outlook Temperature Humidity Wind Tennis? D2 Sunny Hot High Strong No D6 Rain Cool Normal D7 Overcast Yes D11 Mild D12 D14 The chances of the person enjoying tennis, given that it is a strong wind day.

17 Outlook Temperature Humidity Wind Tennis? D1 Sunny Hot High Weak No D2 Strong D3 Overcast Yes D4 Rain Mild D5 Cool Normal D6 D7 D8 D9 D10 D11 D12 D13 D14

18 What’s the use of all this?
We can calculate these numbers on data Leads to an elegant theorem we can make use of

19 A problem to solve: The question: Quick guess:
• 1% of the population get cancer • 80% of people with cancer get a positive test • 9.6% of people without cancer also get a positive test The question: A person has a test for cancer that comes back positive. What is the probability that they actually have cancer? Quick guess: less than 1% somewhere between 1% and 70% between 70% and 80% more than 80%

20 Write down the probabilities of everything…
Define variables: The prior probability of cancer in the population is 1%, so… The probability of positive test given there is cancer, If there is no cancer, we still have The question is: what is… ?

21 Working with Concrete Numbers
10,000 patients p(C=0) = 0.99 p(C=1) = 0.01 100 cancer 9900 no cancer 80 cancer, positive test 20 negative test p(E=1|C=1) = 0.8 950.4 no cancer, positive test 8949.6 negative test p(E=1|C=0) = 0.096 How many people from 10,000 get E=1 ? How many from those get C=1 ?

22 Working with Concrete Numbers
10,000 patients p(C=0) = 0.99 p(C=1) = 0.01 100 cancer 9900 no cancer 80 cancer, positive test 20 negative test p(E=1|C=1) = 0.8 950.4 no cancer, positive test 8949.6 negative test p(E=1|C=0) = 0.096 7.76%

23 Surprising result! Do you trust your Doctor?
Although the probability of a positive test given cancer is 80%, the probability of cancer given a positive test is only about 7.8%. 8/10 doctors would have said: c) between 70% and 80% ……. WRONG!! Common mistake: “the probability that a person with positive test has cancer” is not the same as “the probability that a person with cancer has a positive test”. One must also consider : …the background chances (prior) of having cancer, …the chances of receiving a false alarm in the test.

24 Solving the same problem, via “Bayes Theorem”
The general statement is: And since the statement “E and C” is equivalent to “C and E” :

25 Solving the same problem, via “Bayes Theorem”
Now rearrange…

26 Bayes’ Theorem forms the backbone of the past
Rev. Thomas Bayes, Bayes’ Theorem forms the backbone of the past 20 years of ML research into probabilistic models. Think of E as “effect” and C as “cause”. But.. warning: sometimes thinking this way will be very non-intuitive.

27 Another rule of probability theory: “marginalizing”
we know this we know this we want this we can calculate this Another rule of probability theory: “marginalizing” Think of this as …“given all possible things that can happen with C, what is the probability of E=1 ?

28 Notice the denominator now contains the same term as the numerator.
We only need to know two terms here: p(E=1 | C=1)p(C=1) and p(E=1 | C=0)p(C=0)

29

30 Talk to your neighbours – 5 mins or so.
Bayes’ theorem…. Talk to your neighbours – 5 mins or so.

31 Another Example… what year is it?
You jump in a time machine. It takes you somewhere. But you don’t know to what year it has taken you. You know it is one of 1885, 1955, 1985, or 2015.

32 What year is it? You look out the window… and see a STEAM train.
What are the chances of seeing this in the year 2015 ? Let’s guess…

33 What year is it? In other years? And remember…

34 What year is it? Bayes Theorem to the rescue….
We can calculate the denominator as …

35 What year is it? Bayes Theorem to the rescue….

36 What year is it? Bayes Theorem to the rescue…. For other years….

37 What year is it? Then you look out the window….
And see someone wearing Nike branded trainers.

38 What year is it? But now our belief over what year it is has changed, because of the train… But, Bayes Theorem can just use this, plugging it back into the same equation…

39 What year is it?

40 What year is it?

41 What year is it? Observation Prior belief
We believe we are in 1985, with p = 0.945

42 Bayes’ theorem, done. Take a 15 minute break.

43 More Problems Solved with Probabilities
Your car is making a noise. What are the chances that the tank is empty? The chances of the car making noise, if the tank really is empty. The chances of the car making noise, if the tank is not empty The chances of the tank being empty, regardless of anything else.

44 Bayes’ Theorem

45 Another Problem to Solve…
A person tests positive for a certain medical disease. What are the chances that they really do have the disease? The chances of the test being positive, if the person really is ill. The chances of the test being positive, if the person is in fact well. The chances of the condition, in the general population.

46 Bayes’ Theorem

47 Another Problem to Solve…
Marie is getting married tomorrow, at an outdoor ceremony in the desert. In recent years, it has rained only 5 days each year. Unfortunately, the weatherman has predicted rain for tomorrow. When it actually rains, the weatherman correctly forecasts rain 90% of the time. When it doesn't rain, he incorrectly forecasts rain 20% of the time. What is are the chances it will rain on the day of Marie's wedding? The chances of the forecast saying rain, if it really does rain. saying rain, if it will be fine. The chances of rain, in the general case.


Download ppt "COMP61011 : Machine Learning Probabilistic Models + Bayes’ Theorem"

Similar presentations


Ads by Google