﻿1
00:00:00,166 --> 00:00:01,733
Hello and welcome back to the course.

2
00:00:01,733 --> 00:00:04,033
Today
we're talking about maximum likelihood.

3
00:00:04,033 --> 00:00:06,500
So we have this curve
that's fitting our data.

4
00:00:06,500 --> 00:00:07,333
It's great.

5
00:00:07,333 --> 00:00:12,166
But how do we know that this is the best
curve that can fit our data.

6
00:00:12,433 --> 00:00:15,933
Just like with linear regression
there could be multiple curves

7
00:00:15,933 --> 00:00:17,900
of this shape that could fit our data.

8
00:00:17,900 --> 00:00:20,966
So how do we find out
which one is the best one.

9
00:00:21,333 --> 00:00:24,600
Well we need to calculate the maximum
likelihood.

10
00:00:24,600 --> 00:00:27,733
And the way it's done
is by looking at each data point.

11
00:00:27,733 --> 00:00:33,633
So for example we start here
and finding out for the person of that age

12
00:00:33,633 --> 00:00:38,733
what would have this curve
that we're potentially considering.

13
00:00:38,733 --> 00:00:41,733
What what prediction would have it made.

14
00:00:41,933 --> 00:00:46,766
So this specific curve, 
this specific logistic regression

15
00:00:46,766 --> 00:00:51,133
that we've modeled, it
would have said that a person of that age

16
00:00:51,133 --> 00:00:54,633
has only a 3% chance

17
00:00:55,033 --> 00:00:57,766
of saying yes or taking up the offer.

18
00:00:57,766 --> 00:00:59,366
So it's a very low chance for,

19
00:01:00,633 --> 00:01:04,200
this person or this, a person of this age
to take up the offer.

20
00:01:04,566 --> 00:01:05,700
And then we would continue.

21
00:01:05,700 --> 00:01:11,433
So for the next point where what would
have the logistic regression model.

22
00:01:11,433 --> 00:01:14,400
So we know that this person took up
the offer.

23
00:01:14,400 --> 00:01:17,200
We know it's a
yes because that's our input data.

24
00:01:17,200 --> 00:01:21,466
But what would have
the logistic regression said

25
00:01:21,466 --> 00:01:25,866
if we didn't know that the person took up
the offer and the logistic regression?

26
00:01:25,866 --> 00:01:29,733
The point would be somewhere
here on the curve, and that would be 54%

27
00:01:29,733 --> 00:01:35,400
chance, for this person or for this data
point would be 92% for this data point,

28
00:01:35,400 --> 00:01:37,900
95% for this data point,
our logistic regression

29
00:01:37,900 --> 00:01:41,333
for that specific age,
a person of that age predicts 98%.

30
00:01:41,633 --> 00:01:43,766
So we've got all those numbers. Great.

31
00:01:43,766 --> 00:01:47,733
Now, just to make, to avoid cluttering
this image, we'll,

32
00:01:48,300 --> 00:01:51,300
do the bottom points on a separate image.

33
00:01:52,033 --> 00:01:55,100
So for this point, the logistic regression
predicts

34
00:01:55,100 --> 00:01:58,800
a 1% chance for this point
for somebody of that age.

35
00:01:58,800 --> 00:02:02,233
So logistic regression predicts
a 4% chance for the someone of that age.

36
00:02:02,233 --> 00:02:03,966
A 10% chance,

37
00:02:03,966 --> 00:02:09,033
for someone of that age of 58% chance,
and for someone of the age, a 96% chance.

38
00:02:09,433 --> 00:02:13,400
But remember, on the right side
over here with the nose,

39
00:02:13,666 --> 00:02:19,533
the values that we've illustrated
1%, 4%, 10%, 58% and 96%,

40
00:02:19,766 --> 00:02:23,900
those are the probabilities of somebody
saying, yes, taking up the offer.

41
00:02:23,900 --> 00:02:28,100
So the probabilities of them saying no
are one minus that value.

42
00:02:28,100 --> 00:02:29,500
So let's add that in there.

43
00:02:29,500 --> 00:02:33,600
So one minus each one of those values
is the probability of them saying no.

44
00:02:33,600 --> 00:02:37,766
So for example for the first point
it is actually a 99% chance.

45
00:02:37,766 --> 00:02:41,766
The logistic regression is predicting
that someone that of that age,

46
00:02:41,766 --> 00:02:45,400
there's a 99% chance
that they will say no to the offer.

47
00:02:46,200 --> 00:02:49,066
And now, we need to calculate likelihood.

48
00:02:49,066 --> 00:02:52,466
Likelihood is calculated
by simply multiplying all these numbers.

49
00:02:52,466 --> 00:02:54,600
So on the blue side
we multiply these numbers.

50
00:02:54,600 --> 00:02:56,866
On the red side we multiply these numbers.

51
00:02:56,866 --> 00:02:59,800
And we get our value for likelihood.

52
00:02:59,800 --> 00:03:03,166
And then the way to find the best fitting
curve is

53
00:03:03,166 --> 00:03:06,300
to look through
all possible sorts of curves.

54
00:03:06,933 --> 00:03:11,100
Of course, there's a more sophisticated
process behind this, but in a nutshell,

55
00:03:11,100 --> 00:03:14,866
you compare what the likelihoods
are of different curves.

56
00:03:14,866 --> 00:03:18,700
So let's say we our logistic regression
modeling process

57
00:03:18,700 --> 00:03:22,500
started with this curve and calculate
the likelihood to be this value.

58
00:03:22,800 --> 00:03:26,700
Then it went on to the next curve
and it calculated the likelihood

59
00:03:26,700 --> 00:03:29,500
to be this value. Then the next curve
the likelihood was this.

60
00:03:29,500 --> 00:03:34,900
And through this iterative process
it found the curve with a maximum

61
00:03:35,400 --> 00:03:36,000
likelihood.

62
00:03:36,000 --> 00:03:38,533
So this would be the maximum
likelihood of all the curves.

63
00:03:38,533 --> 00:03:40,466
And that means this is the best curve.

64
00:03:40,466 --> 00:03:42,800
And that's
how the maximum likelihood is calculated.

65
00:03:42,800 --> 00:03:46,700
And that's how the best fitting
curve of logistic regression is found.

66
00:03:46,800 --> 00:03:48,133
I look forward to seeing you next time.

67
00:03:48,133 --> 00:03:50,033
And until then, enjoy machine learning.
