What do we learn from training our dataset in Logistic Resgression? Like in Linear Regression, with the help of training set we are able to generate a best fit line(y = mx+c) where m and c come from training our dataset. Similarly, once we train our model for logistic regression, what is that the model learns which is then used to predict a class for a particular input?


I hope this is what you are looking for:

In Linear regression, the parameters are learned (e.g. theta1,theta2, etc.) which are then used to help us in predicting the real value ( as it is the regression problem) But In case of logistics regression (as it is used for classification purposes) the same parameters are learned but different activation function is used like sigmoid which results in the range of 0 to 1( which actually shows the probability of an outcome). So, based on your requirement, if the result of the sigmoid or any other activation function crosses a certain threshold value which can be any between 0 to 1, then it is classified as one class otherwise the other class.

For example, If after multiplying all the parameters and input values and then applying activation function on the multiplication result, the output value is 0.7 which let say is great than our threshold value(e.g. 0.5) then it is classified as YES otherwise NO.

| improve this answer | |
  • $\begingroup$ Let me know if you want to know anything else. I would be glad to help you out. $\endgroup$ – Faizan Khan Aug 31 '19 at 5:06
  • $\begingroup$ Thanks Faizan. From what I understood, we still predict a y value like we did in regression and then pass that value through an activation function and then it maps to a probability value. I would want to know that when solving classification problem, training dataset only has labels in the prediction(y_train) column, whereas in regression problem,the prediction value would have continuous values which would help obtain the necessary parameters. How are those parameters obtained for logistic regression for we only have labels in dependent variable?Please excuse the naiveness as I'm a beginner $\endgroup$ – Mayank Mishra Aug 31 '19 at 7:06
  • $\begingroup$ By parameters, I mean slope and intercept. $\endgroup$ – Mayank Mishra Aug 31 '19 at 7:09
  • $\begingroup$ Well if your concern is that how categorical labels are treated during the process then Label encoding or one hot encoding is used to convert the label into numeric values... continue $\endgroup$ – Faizan Khan Aug 31 '19 at 7:12
  • $\begingroup$ Here is the link where you can see how encoding is performed google.com/amp/s/machinelearning-blog.com/2017/12/27/266/amp $\endgroup$ – Faizan Khan Aug 31 '19 at 7:19

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.