Now let's learn how to create a logistic regression with multiple independent variables and by.
We will use the same template and the same code which we use for creating logistic regression with a
single variable will just change our X and Y variables.
And we will use this same port.
Remember, if you are reopening your python, you need to import all the libraries that we imported
earlier.
And you just have to give values of your X and Y to create this model similar to last time.
We'll use two libraries for space, a skillern and then start smaller.
So this thing, our X, which is independent variables, should contain all the variables except sold
variable from our data frame.
Since we do not want this sorry variable, we can remove this from our data frame.
So we'll be at door lock.
And then we will put the colon.
Since we want all rules, we are just put in colon.
This means all rows.
Then we'll put comma the argument before this comma.
As four rolls.
So if you mention any specific rule, it will only fit those rules.
But since we want all the rules, we have put colon.
And after this comma, we need to mention our column names since we need all the columns except the
sorted volume will write B.F. dot columns.
Not according to solid.
We'll run this over X really believes that, Eddie.
We need on these solid variable from our data frame as dependent variable rate like we to be.
And then a squared record.
I will mention the column name that is sort.
If you want to look at the data, you can take head of X and Y, we will follow the same step as we
did for logistic regression model with single variable, with first clear classifier object of logistic
regression and then fade X and Y into that object.
So does the same code as last time.
So we will get a clear trend.
This.
We have fitted our model to look at the coefficient value of this model.
We have to call attribute of this object, which is quiff underscored
since our model is allowed.
We will write C11, score a la dot quiff, underscore this.
These are the coefficient.
So the first one is between, the second one is Bitauto and so on.
So the coefficient of your prize variable is minus zero point two five.
And then our next variable was that I said a.D.A.
So the coefficient of, let's say the area is minus zero point zero zero eight six and so on to get
the value off and be done or which is intercept.
We'll write CLV, underscore a la dot intercept.
You can see this is the value of Bedazzler.
Now we have values of all the B does, but does it all be done up to be happy?
We can use these values to get the equation of what logic function.
Using this bit of values, you can predict the probabilities and we will use those probabilities to
predict why variable and coming radios.
This is all you for logistic regression model and a Skillern on let's move on to a sex model.
As I mentioned earlier, for sex model, we need to add consent and deliver X by default.
The intercept value is zero and it sets model.
That is B to zero, equal to zero.
But to add consent, we will create X, underscore Korn's variable.
Remember to import the sex model liabilities before executing this.
Come on.
Now let's forget this model.
We will use the same code that we use for logistic regression with single word even
and to get the summary of this model.
Well, right.
Logic, not somebody.
You can see in the bottom table we have all the variables as the rules and we have their coefficient
in the first column.
And then we have other values, such as the standard error, the value and p value for each of these
variables.
This is how we run the model.
We discuss the result and upcoming weirdo's.