Week#1 Cost function formula

I am new in Linear Regression.
Could any one please tell me that is w a slope or w/1 is slope. if w/1 is slope what is the meaning of it

1 Like

In the case of linear regression with a single weight/feature, then w is the slope. In math, w/1 is equal to w, so you can say w/1 is also the slope (because they are equal).

In the linear regression equation,

y = wx + b

The w is the slope. It means that if x changes by 1, then y changes by w. If x changes by 2, then y changes by 2*w, and so on.

1 Like

Thanks for your reply.
I know that w/1 =w but why we are using w/1, that is why i am asking that what is the use of 1 in denominator. Is there any situation where w/2 or w/5 can be a slope because in Line equation we always learn that in y=mx+c where m is always a slope

In this particular case, w = m is the slope. The w here is called a variable, and stores a value. The variable name w does not change, and the formula with w does not change, but the value of w can change.

We will not rewrite w into w/2 or w/5 in the formula. The formula is y = wx + b, and we will never write it as y = (w/2)x + b.

However, suppose the value of w is 10 and b is 0 for a particular regression model. If you apply those to the formula, you will have y = 10x + 0 or y = 10x.

If we have training data that says that if w is 5, the model will be a better fit, then we can change the value of w to 5. The formula with the w variable is still y = wx + b, but when plug in the values of w , you will get y = 5x + 0 or y = 5x.