1️⃣

# 8.1 Polynomial Regression: The Idea

Now that we have discussed a few kinds of Linear Regression, it's time to move into non-linear regression. Like your time at school, the easiest stepping stone is Polynomials.

Just for revision, polynomials are rational expressions that follow the format:

Depending on whatever value of you use

Often, polynomial functions can fit data better because they're capable of producing more complex curves, like so:

With polynomial regression, we want to produce a polynomial model that fits the data well, just like we did with linear regression.

## 2 Questions about the polynomial model

### 1. What is ?

Essentially, we have to decide what degree of polynomial you want to use to model the data. This can be a matter of trying out the possibilities, but sklearn makes it easy to do this. However, make sure you don't choose too large of a value for because that can easily cause your model to overfit by introducing too much complexity. For example, a simple linear regression would probably be sufficient in the below example. However, when you run polynomial regression on the data with a high , you can create curves that don't generalize to new data very well:

### 2. What parameters do we want?

This we'll deal with the way we have always dealt with parameters, so that's not a big deal.

⚖️