Hello and welcome back to the course.
Today we're talking about maximum likelihood.
So we have this curve that's fitting our data.
It's great.
But how do we know that this is the best curve that can fit our data.
Just like with linear regression there could be multiple curves
of this shape that could fit our data.
So how do we find out which one is the best one.
Well we need to calculate the maximum likelihood.
And the way it's done is by looking at each data point.
So for example we start here and finding out for the person of that age
what would have this curve that we're potentially considering.
What what prediction would have it made.
So this specific curve, this specific logistic regression
that we've modeled, it would have said that a person of that age
has only a 3% chance
of saying yes or taking up the offer.
So it's a very low chance for,
this person or this, a person of this age to take up the offer.
And then we would continue.
So for the next point where what would have the logistic regression model.
So we know that this person took up the offer.
We know it's a yes because that's our input data.
But what would have the logistic regression said
if we didn't know that the person took up the offer and the logistic regression?
The point would be somewhere here on the curve, and that would be 54%
chance, for this person or for this data point would be 92% for this data point,
95% for this data point, our logistic regression
for that specific age, a person of that age predicts 98%.
So we've got all those numbers. Great.
Now, just to make, to avoid cluttering this image, we'll,
do the bottom points on a separate image.
So for this point, the logistic regression predicts
a 1% chance for this point for somebody of that age.
So logistic regression predicts a 4% chance for the someone of that age.
A 10% chance,
for someone of that age of 58% chance, and for someone of the age, a 96% chance.
But remember, on the right side over here with the nose,
the values that we've illustrated 1%, 4%, 10%, 58% and 96%,
those are the probabilities of somebody saying, yes, taking up the offer.
So the probabilities of them saying no are one minus that value.
So let's add that in there.
So one minus each one of those values is the probability of them saying no.
So for example for the first point it is actually a 99% chance.
The logistic regression is predicting that someone that of that age,
there's a 99% chance that they will say no to the offer.
And now, we need to calculate likelihood.
Likelihood is calculated by simply multiplying all these numbers.
So on the blue side we multiply these numbers.
On the red side we multiply these numbers.
And we get our value for likelihood.
And then the way to find the best fitting curve is
to look through all possible sorts of curves.
Of course, there's a more sophisticated process behind this, but in a nutshell,
you compare what the likelihoods are of different curves.
So let's say we our logistic regression modeling process
started with this curve and calculate the likelihood to be this value.
Then it went on to the next curve and it calculated the likelihood
to be this value. Then the next curve the likelihood was this.
And through this iterative process it found the curve with a maximum
likelihood.
So this would be the maximum likelihood of all the curves.
And that means this is the best curve.
And that's how the maximum likelihood is calculated.
And that's how the best fitting curve of logistic regression is found.
I look forward to seeing you next time.
And until then, enjoy machine learning.