Hi all, I'm taking a machine learning computer programming course and am in the polynomial regression section. I'm having trouble understanding the equation for polynomial regressions.
specifically:
I haven't dealt with this type of math since high school and was wondering if someone could help me understand what this means. Here's what I think I understand so far:
If I have a dataset of the following (let's say b0 is 40,000):
Then I can find the linear regression by y = 40,000 + b1 * x1
if b1 = (50,000-45,000)/(2-1) then b1 = 5000
therefore 45000 = 40,000 + 5000 * 1
I gather that I need to add in the b2x1^2 but if I try to use a similar method to find b2 then I get confused and can't get it to work out:
45,000 = 40,000 + 5000 * 1 + b2 * 1^2
45,000-40,000 = 5000
5000 = 5000 *1 + b2 * 1
5000 - 5000 = b2 * 1
b2 =0
which makes sense because b2 and x1^2 need to cancel each other out so that y can equal 45,000...
Then inserting x and y from the second row of data to try and solve for b2 again
50,000 = 40,000 + 5000 * 2 + b2 * 2^2
50,000 - 40,000 = 10,000
10,000 = 10,000 + b2 * 4
0 = b2 *4
b2 = 0
I don't really know where to go from here to understand how the equation eventually creates a curved line that will closely fit the data points in the table. I'm sure I'm way off on something I just can't figure out what.
Thanks!
specifically:
I haven't dealt with this type of math since high school and was wondering if someone could help me understand what this means. Here's what I think I understand so far:
If I have a dataset of the following (let's say b0 is 40,000):
Level | Salary |
1 | 45,000 |
2 | 50,000 |
3 | 60,000 |
Then I can find the linear regression by y = 40,000 + b1 * x1
if b1 = (50,000-45,000)/(2-1) then b1 = 5000
therefore 45000 = 40,000 + 5000 * 1
I gather that I need to add in the b2x1^2 but if I try to use a similar method to find b2 then I get confused and can't get it to work out:
45,000 = 40,000 + 5000 * 1 + b2 * 1^2
45,000-40,000 = 5000
5000 = 5000 *1 + b2 * 1
5000 - 5000 = b2 * 1
b2 =0
which makes sense because b2 and x1^2 need to cancel each other out so that y can equal 45,000...
Then inserting x and y from the second row of data to try and solve for b2 again
50,000 = 40,000 + 5000 * 2 + b2 * 2^2
50,000 - 40,000 = 10,000
10,000 = 10,000 + b2 * 4
0 = b2 *4
b2 = 0
I don't really know where to go from here to understand how the equation eventually creates a curved line that will closely fit the data points in the table. I'm sure I'm way off on something I just can't figure out what.
Thanks!