Multivariate logistic regression in Python
Multivariate logistic regression
Difference between single variate and multivariate regression :
Suppose we have data of the customer will buy insurance or not? Here you can see your prediction or target is only yes or no. you can also say that 0 or 1 .
now suppose you have to build model in which you have to decide which party a person is going to vote for? so there are many target value for this like democratic,republic,independent and many more,Here you have more then two possible outcome so its called multivariate regression.
Multivariate logistic regression in Python:
Here problem is given that we have hand written digit(0 to 9) data set and we have to build machine learning model that predict the which digit is it.
So you can clearly notice that our target value is 0 to 9 which means total 10 possible outcome. so it is the example of Multivariate regression. We will use logistic regression for this.
First of all import library
Lest check how actually looks image
If you want to plot this array then
Lest build the model
confusion matrix :
You can also check where our model predict the wrong digit using confusion matrix method.
Here lets say truth value is 8 but our model predict 6 one time except the diagonal where ever you see the number which is wrong prediction done by over model.
Comments
Post a Comment