Posts

Showing posts with the label Logistic Regression

Multivariate logistic regression in Python

Image
 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 Now we load t...

what is Logistic Regression ?

Image
  Implementation of  Logistic Regression  Logistic regression is the appropriate regression analysis to conduct when the dependent variable is binary. Basically logistic regression is working on this formula : Now the question is there is already linear regression available then why we need logistic regression?  Logistic regression vs linear regression : Lets understand the concept of why we need logistic regression. consider below graph and fit line using leaner regression.  so you can clearly saw that it's a very inappropriate way to fit line and our ml model accuracy look bad.  Lets now fit the line using Logistic regression  You can clearly see the difference which method is useful and accurate.  Logistic regression in python : Now lets do some coding We will predict the person have insurance or not on the basis of his/her age. First we import the library Lets read the data from the csv file. visualising data using scatter plot Lets ...