# Parametric Estimation for Simple Polynomial Regression

In cases where the data cannot be fit using a linear decision boundary, we may want to use polynomial regression.

![](https://335259370-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-M5-0RGi-3PgC2puufMH%2F-M5-0Ri_FPdoeNpowHRz%2F-M5-0UPIciEEJ5aBOesC%2Fpolynomial%20regression.png?generation=1586990817997948\&alt=media)

Say we want to use a degree 2 polynomial. The equation can be given by:

$$g(x|w\_2,w\_1,w\_0) = w\_2x^2 + w\_1x + w\_0$$

Our aim is to find values for $$w\_0,w\_1,w\_2$$ that minimize the squared error $$\sum\_t (r^t-g(x^t))^2$$

**Note**: Given a dataset $${x^t,r^t}\_{t=1}^N$$ where $$x^t\in R$$ i.e. where $$x^t=\[x\_1^t]$$ (1 dimension), to find the polynomial of degree 2\
$$g(x|w\_2,w\_1,w\_0) = w\_2x^2 + w\_1x + w\_0$$ that minimizes the squared error, we can construct a related dataset with inputs in $$R^2$$ (2 dimensions) with the second dimension $$x\_2^t=(x\_1^t)^2$$, and then use simple linear regression on this new dataset to obtain $$w\_2,w\_1,w\_0$$ that minimize the squared error, and finally output $$g(x|w\_2,w\_1,w\_0) = w\_2x^2 + w\_1x + w\_0$$ with these $$w\_2,w\_1,w\_0$$ values as the best 2 degree polynomial that fits the original dataset.

This can be extended to higher degree polynomials as well.
