I was attending a course on logistic regression in ml of andrew ng. On what basis the equation is decided and whether it is accurate or not, how is it calculated. What if I change the equation? How will it impact the prediction?
Regards
I was attending a course on logistic regression in ml of andrew ng. On what basis the equation is decided and whether it is accurate or not, how is it calculated. What if I change the equation? How will it impact the prediction?
Regards
Which equation are you referring to specifically?
It would help if you post a screen capture image.
It’s been a while since I watched the lectures in this section of the course, but I’ve got to believe that Professor Ng discusses these points in the lectures. I know the DLS material better and there (DLS C1 W2) he does discuss the ideas behind Logistic Regression and how it was derived.
The fundamental idea is that you take all the input features and you apply a linear transformation to them. Well, if you want to go “full math” here, the technical term is an “affine transformation”, since it includes the bias term (the +b) which is also sometimes called the intercept:
z = w \cdot x + b
Then you apply the sigmoid function to the output of the linear function and that converts the value into something that can be interpreted as a probability: the probability that the answer to your classification question is “yes”. E.g. “Yes, this picture contains a cat”.
Of course one fundamental limitation of that method is that it can only create linear decision boundaries. Unfortunately not all data is simple enough to have linear decision boundaries.
Professor Ng also shows us potential ways to handle cases that require non-linear decision boundaries. One method is to do a pre-processing step in which you create polynomial combinations of your input features and then use that expanded set of polynomial features as the input to Logistic Regression. That gives you the ability to detect non-linear boundaries.
If you need even more complex boundaries, then we can replace the function that converts the input features to the input to sigmoid with a multi-layer Neural Network. That gives us the ability to create much more complex functions but in a way that is computationally tractable and which allows efficient learning through “back propagation”.
So one way to think about all that is as a concrete way to flesh out your intuition about “changing the equation”. ![]()
My suggestion would be to “hold that thought” and proceed on through the courses of MLS and DLS with that in mind and watch how the functions get more complex.
That’s just an example, using two feature values (x0 and x1) with weights of 1, and a bias value of -3.
In a real machine learning problem the weights and bias would be learned from a data set (the x and y values) so that the difference between the predictions f(x) and labels (y) would be minimized.