Okay.
So let's go back to our classifier.
So the pre-processing is done.
And now we're going to create our classifier.
Everything should go well.
I don't have to select this because mine was already selected.
So let's press Command and Control plus enter to execute.
And here it is classifier created.
All good. Okay.
And now we can make some predictions of new observations which are here to test
that observation.
So let's do it. Why pred wipe. Right.
All right.
So let's have a look at why pred y pred.
So these are all the predictions of the test set observations.
That is, for each user of the test
set, our classifier predicts if the user buys the SUV or not.
So let's compare
the predictions with the truth which are contained in the test set.
So this column tells the truth about whether the users
but yes or no, the SUV and this are the predictions.
That is our SVM classifier predicted whether each user bought
yes or no the SUV.
So let's look at, for example, the well.
Okay.
So all these first guys here where predicted not to buy the SUV.
We have all zeros until the 103.
But here as you can see we have some guys who actually bought
the SUV in reality is to 18, 19, 20 and 22.
So our classifier predicted that they didn't buy it.
And the truth is that they actually bought it.
So that's incorrect predictions.
But let's look at the incorrect predictions in a more efficient way
by looking at the confusion matrix.
So let's select this line here and execute.
And now let's find out about the real number of incorrect predictions.
So let's type CM here in the council and press enter.
And wow that's actually a quite large number of incorrect predictions.
And by the way we don't obtain the same results as in Python because we have some
random factors in the model.
And here we didn't specify C.
So you might actually have some different results.
But the idea is here.
So okay so let's look at now the graph to see how it's doing.
So for those of you who actually didn't watch the Python tutorial about SVM,
a good exercise is to try to guess what's going to happen.
That is what are going to be the prediction regions.
What is going to be the prediction boundary?
What do you guess you will see?
So I will let you think for a second.
You can pause on the video.
And right now I'm going to tell you.
So as you notice we chose a linear kernel,
which means that our SVM classifier is a linear classifier.
So as I explained in the logistic regression tutorials on Python and R,
well, a linear classifier in 2D dimensional space is a straight line.
So here I'm telling you this right now we are going to get a straight line.
Not to get any disappointment because I know we improved our model with the K.
And before we obtained a good prediction boundary that got,
you know, those users on the bottom right corner that actually bought the SUV,
but who were incorrect predictions for logistic regression?
Well, here it's also going to be some incorrect prediction for the linear
SVM because it's actually a linear classifier.
So let's look at the results right now.
Select this and press Command and Control.
Press enter to execute.
And here are the results.
Okay. So as you can see that's exactly what I just told you.
You know those users here with a lower salary and the higher age.
Well, they actually bought the SUV in reality,
because the points are green, the points are the real observations.
But they fell into the red region here because since the linear classifier
is a straight line, it couldn't, you know, make some kind of a curve here
to catch all the red points into the right place.
And therefore it cut some green points, putting them in the red region.
So yeah, that's exactly the same as for logistic regression.
Sorry about the disappointment, but don't worry.
In the next section we will introduce a new kind of classifier
which will be well the kernel SVM with a different kernel than linear kernel.
It's going to be a Gaussian kernel.
Or even we can try some more kernels.
Well you can practice that yourself.
It can be very good practice for you.
But here. Yes, it's a linear classifier.
So basically it's the same as logistic regression.
And if we look at the test set results is going to be the same.
Let's have a look.
And here is the test set okay.
So yeah same thing here.
We have some users of higher age and lower estimated salary.
Who bought the SUV but fell into the red region.
Again because our class for you is a straight line.
And that's the best you could do to classify those two points.
And place them into the corresponding category.
So a few incorrect predictions here, a few incorrect predictions here.
And if you want, you can count the number of incorrect predictions.
That is the number of green points in the red region
plus the number of red points in the green region.
And you will count the number of incorrect predictions we found in the confusion
matrix, which was 20 incorrect predictions.
But that's great that we have this result, because that gives us the motivation
to improve our classifier, improve our model,
and that's what we're going to do in the next section.
So I look forward to seeing you in the next section
and show you how we can substantially improve our classification model.
So I look forward to showing you the next level.
And until then, enjoy machine learning.