C1_W1_Regression-Model


What i am comprehending from the images:-

In 1st image, we have b = 0, and in 2nd b = some value , let’s say 50.
So since b is constant , we don’t need a three dimensional graph.

My question
Can J be zero only when b = 0? if not how can i test it / visualise it properly

Hello @SantoshKumarDoodala

b is not a constant. Just like w it can take any number of values. Each combination of (w,b) corresponds to a unique Regression line. Each Regression line will have a specific Cost value J. Our aim is to find a specific (w,b) that will give us a Regression line which will have the lowest value for J

In the case of Linear Regression we use the squared error cost function. The cost J will be 0 ONLY if ALL the predicted values \hat y EXACTLY matches with the corresponding values of the target value y In simple terms this means that EVERY value of y should lie on the predicted regression line.

1 Like

actually what i meant to say was for that particular scenario where b = 0 which in itself means it is constant for that scenario

so it can be deduced that there are scenarios where b has some value and J is 0

Absolutely. b can be non-zero and J can still be 0

2 Likes

b and w are learned so that the cost J is minimized. They can take on any real values.
J is typically not going to be exactly zero, except for very simple data sets.

2 Likes