So in this we do we will learn how to find out the probability of whether a house will be sold within
three months or not.
Given the values of other predictors.
So since we have already 50 model in this deal, I'm not fit very well.
We can use this model to calculate the probabilities using the predict function.
So we will create another variable which will take the probabilities.
It will be called Delimit Dark from.
Is equal to predict
the bracket will write delimit outfit, which is the name of the evil in which we have information of
the model comma.
Type is equal to response.
So you can see on the right we have this new variable delimiter probs, if you want to look at the first
10 values of probabilities, we can IDL MDR probs from one to 10.
So in the bottom, you can see what he first said.
The guy's loaded probability is zero point eight five, which is very close to one, which suggests
that the first holes will be sold within three months.
Second value is telling us that 67 percent chance of House getting sold in the first two months.
The third house is having only a probability of zero point three four, which means that there is only
three percent chance of the House getting sold in the first three months and so on.
So we have these values.
What all leave?
I wonder six obstetrician's.
Now, as I told you, in the end, it's really clear that using a boundary condition, we can assign
classes to these values.
So if I have a boundary condition on point five, I can say that any value, any pro will devalue,
which is greater than point five.
I would classify it as.
Yes.
Meaning that it will be sold in dreamland and wherever the probability values less than point lead.
I will say that no, it will not be sold in three months.
So to create this area of response is containing yes and no.
We will first create an entry called Dehlin.
Not predict is equal to
repeat.
So rep.
Basically I want to first create a array of 506 values in which only values as containing no
comma 506.
It's an array with 506 values and all the values are all on the right.
You can see that we have this every now whenever the probability will lose more than point three.
I will change this.
Nor do.
Yes.
So Gillmore played.
We good record.
We will mention the condition that delimiter probs is greater than point five in all these locations,
in all these locations.
I want.
Yes.
So you can see the first two Aleuts I know, yes.
The third well-used.
No.
Which I also discussed.
Now that we have the predicted classes, for all the 506 observations, we can create the conclusion
matrix confusion matrix will have predicted values on one side and the true values on other to create
confusion matrix.
We will use that table function and the table function.
We have to give
two parameters.
The first parameter is DDL and bread values, which had the predicted values of
whether the house will be sold or not.
And the second is the actual value of whether the house will be sold or not.
Which is D.F. Dollar sold.
So this first parameter, which has the predicted values, will be coming as rules.
And the second parameter will just be if Dollar sold will be coming at two columns.
So let us run this in the bottom.
You can see.
No.
And yes.
Are the predicted values which we have as rules.
Zero and one are the actual values which we have as columns.
The first sin is telling us that one nine four one ninety seven cases.
The actual value is zero.
That is, the house will not be sold.
And we also predicted that it will not be sold.
So we were right in predicting these values.
Similarly, these 149 cases, the actual words also one.
And we also predicted.
Yes.
So that is also correct.
But these are the two values where actual ojito.
And we predicted.
Yes.
And actual odds one.
And we really didn't know.
So this 79 and 81, I need to edit.
So using these few lines of code, we can get the probability of that case belonging to each class,
then using a ball degradation.
We can assign a class to each observation using those predicted values of classes and the actual value
of classes.
We can draw this conclusion matrix to see how well our model is predicting the response where he would.