How to to choose theta value when calculating hypothesis on linear regression?

531 Views Asked by At

I am new to data science and my math skills are really rusty. I am try to understand linear regression, but unfortunately there is one thing that is not clear to me. Assuming I have these data (or these values x and y): {(0,1),(1,3),(2,6),(4,8)}. If this is the formula for the hypothesis:

Y = Β0 + Β1X

Then how do I generate the values B0 and B1? I see many examples using this set of values for B0 and B1:

B0   |   B1
1.5  |   0
0    |   1.5
1    |   0.5

But none of them explains how they came to that conclusion. Could someone help me understand how the hypothesis function works? I appreciate any help you can provide

1

There are 1 best solutions below

0
On

Look at this page : http://mathworld.wolfram.com/LeastSquaresFitting.html

Your problem is treated equations 7-10 with notations $a=B0$ and $b=B1$ .

NUMERICAL EXMPLE :

enter image description here

The theory of mean least square linear regression is explained in the paper referenced above. It's up to you to study it.

Calculus of MSE :

Error on each point : $\quad \epsilon_k=y_k-(B0+B1\:x_k)$

$$MSE=\frac{1}{n}\sum_{k=1}^{n} (\epsilon_k)^2$$ I suppose that you can compute it.