All right, my friends.
Let's see if you
managed to build and train on your own this logistic regression model.
And I will go right now to the documentation to scikit learn API
in order to show you how to indeed find information on your own,
which is here, how to build that logistic regression model.
All right.
So let's do this. Let's open a new tab here.
And in the search bar let's just type scikit learn perfect.
Let's press enter.
And let's go you know to the first link which is the main page of scikit learn.
Then remember it's good to go to API here.
The other option was to directly type here in the search bar
scikit learn logistic regression class okay.
But I really want to show you again the API because indeed it contains
everything.
You know, all the things you can do with scikit learn.
So now we're going to scroll down to find classification
which is in a module below
called linear models.
Why is that?
That's because of course the logistic regression model is a linear model.
And we will clearly see that at the end with the visualization.
And you will clearly see, you know, how to
make the difference between a linear model and a non-linear model.
So we'll come to that later. But there you go.
This is where you find, you know, knowing that linear model
module of the scikit learn library, all the linear classifiers.
And one of them is of course the logistic regression.
So we're going to click this.
And there you go.
Here you have the whole documentation of the logistic regression class.
You know this is the name of the class that allows the built
the logistic regression model.
And so that's all you needed to get.
And you could get exactly the same thing by just typing here
in the search bar scikit learn logistic regression class.
You know you will end up in the same page.
So now what we will only take is you know the name of the class plus the module.
And if you want scikit learn and then we will rewrite it
the right way to import our class and then create the object.
All right.
So let's just copy this and then remember the syntax is to start with from.
So from scikit learn.
And then from the linear model module of scikit learn.
And from this linear model module
you import that logistic regression class.
All right.
So that's the usual syntax
we take from the linear model module of the scikit learn library.
We import the logistic regression class.
And now now the next natural step is to create an object of this logistic
regression class, which will be exactly the logistic regression model itself.
And since now we are in classification and no longer in regression,
well we're going to call our model classifier.
All right. So let's do this classifier.
And that's how we'll call all our other classification models of this part three.
So classifier.
And then you know the next step we have to call the class.
That's how we create an instance of a class.
So there we go.
And then we add some parenthesis.
And now the question is do we have to input any parameters.
Well.
So far we would just like to build the logistic regression model.
But then don't worry.
In part ten I will teach you how to tune your models,
which consists of, you know, choosing the optimal values of your parameters
in order to take the best version of a model, but this will come later.
Important so far, let's just focus on how to build and train the simple
logistic regression model, which will yet provide amazing results.
All right, so no parameters here.
However, we'll just, you know, and to this random state parameter
which will allow us to get the same results displayed on our notebook.
So this is just for teaching purposes.
You don't have to do it on your own data sets for your own problems.
All right.
So random state and we'll set that equal to zero.