# How is y=mx+b different from hθ(x)=θ0+θ1x?

I could not quite comprehend the hypothesis represented by hθ(x)=θ0+θ1x To find out good values for the parameters θ0 and θ1 we want to minimize the difference between the calculated result and the actual result of our test data. So we subtract hθ(x(i))−y(i) for all i from 1 to m. Hence we calculate the sum over this difference and then calculate the average by multiplying the sum by 1/2m. This would result in:

## 1/2m∑mi=1(hθ(x(i))−y(i))2

So, I googled further and landed on a youtube video that talked about y=mx+b, where m is the slope and b is y intercept. This is called a Linear Model.

Also, in the linear model, the following formula is used to determine m and b.

Now my questions are:

1) Is the hypotheses and the linear model the same? 2) Is there a cost function for the linear model? 3) Why would anyone want to guess, choose and arrive at θ0 and θ1 when there is a straight forward formula (linear model)?

1) Your hypothese $$hθ(x)$$ is clearly a linear model with $$b \leftrightarrow θ_0$$ and $$m \leftrightarrow θ_1$$ as you expected (don't be too hesitant and your colleges could have been able to confirm this).
2) Lets call $$hθ(x_i)$$ the prediction $$p_i$$. A cost function $$C$$ can be any function that when you try to minimize it holds a good solution. One example would be the mean squared error (mse): $$C(p_i, y_i)=1/2 \cdot (p_i - y_i)^2$$. I'm quite sure the mse is used to optimize the linear model, however other cost functions are possible.
3) I suppose this is an assignment? You clearly gave a very good suggestion to approximate your data. I suppose the goal of your task was to come to the solution of the linear model yourself. Try to understand how $$b$$ and $$m$$ is estimated in the linear model.