All right.
So what we're going to do now is we're going
to get that whole code, you know, from the original file.
We're going to paste it inside or new implementation.
There we go.
And we're going to do the same for the to set.
And then I will actually try
not to show you the test it now but let's get the code.
Let's paste that below in a new code cell.
And now let's enjoy the results.
So what we're going to do is first execute the cell.
It's going to take a little while actually because you know the step is oh point
25 meaning we will get a very very dense grid as I've just explained.
And therefore, you know, the predict
method is applied on each of these dense points of the grid.
And that's why they're actually a lot, lot, lot of predictions to compute.
And that's why it's taking a little time.
But there you go. It's coming.
Here we go.
So not that long. That's good.
We just got the results of the training set.
Let's also plot now the results of the test set.
And then I will make my comments on the results.
All right.
So we can just let it run
and start by observing and interpreting the results of the training set.
All right.
So just to recap you have to understand four things in this plot.
Is that all the points that you see here, whether they're red or green,
are the real customers, and they're real results in the training set.
The green points correspond, of course, to the customers
who bought the previous SUVs, and the red points correspond,
of course, to the customers who didn't buy any previous SUV.
And then the other two things to understand is that those colored regions
here, you know, this red region and the green region are the prediction regions.
So this region is the region where our model predicts
that the customer didn't buy the SUV.
And this region is the region where our largest regression
model predicts that the customers but the previous SUV.
And so in order to figure out where the correct predictions are
and the incorrect predictions are, well, the correct predictions are where we have
some observation points with the same color
as the prediction region, and the incorrect predictions are
where we have some observation points with a color that is different
than the prediction region.
So for example, this customer here who in reality
but the SUV, you know, corresponding to one here
is actually an incorrect prediction because it falls into the wrong region.
The red region, and vice versa.
This customer here, who in reality didn't buy the SUV because it corresponds
to zero, well, it's the wrong prediction because it falls into the green region
where customers are predicted to buy the SUV.
And then finally,
what's the most interesting in all this is the prediction boundary.
As you understood, the prediction boundary is
the boundary between those two prediction regions.
You know, the green prediction region and the red prediction region.
It is where your classifier separates
basically the two classes the class one and the class zero.
And now you have to understand something very, very important.
It is the fact, you know, it is the observation that the prediction
curve of the logistic regression model is actually
a straight line for one specific reason.
It is because the logistic regression model is a linear classifier.
For any linear classifier, the prediction boundary
or the prediction curve will always be a straight line.
You know, in two dimensions.
In three dimensions it will be a straight plan.
Okay, so that's what we get for linear classifier.