why are we using-
qx=np.mat([query_x,1])
we can just pass query_x as the query point in getw() function.
why are we using-
qx=np.mat([query_x,1])
we can just pass query_x as the query point in getw() function.
hey @yashikakhurana00 ,
as our hypothesis says , y_pred = theta_1x1 + theta_0
which can also be stated as y_pred = theta_1x1 + theta_0*x_0 where x_0 = 1.
these both are the same things , Agree ?
So , currently we just have a matrix with shape M*1 and if we multiply these values with theta matrix , we will be getting resultant as a single value theta_1 of above equation , which also the slope of that equation and not the theta_0 value as there is nothing to multiply to it and hence it gets ignored.
To count theta_0 in our equation, we just add another column with all values to be as 1 so that on multiplication we can get theta_0 also as a resultant ( intercept value ).
I hope this would have resolved your doubt.
Thank You and Happy Learning
.