# 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.

![](/files/-M5-0UPIciEEJ5aBOesC)

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.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://vikram-bajaj.gitbook.io/cs-gy-6923-machine-learning/main-4/types-of-machine-learning/supervised-learning/parametric-estimation/parametric-estimation-for-polynomial-regression.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
