Regression: polynomial regression

Regression: polynomial regression


Why Polynomial Regression?

In simple linear regression algorithm only works when the relationship between the data is, well, linear. But suppose if we have non-linear data then Linear regression will not capable to draw a best-fit line. Consider the below diagram which has a non-linear relationship and you can see the Linear regression results on it, which do not comes close to reality. Hence, we introduce polynomial regression to overcome this problem.

Linear regression on non-linear data

Math

The equation of polynomial looks like this:

Implementation

Firstly, let's import libraries, create data and visualize it.

Secondly, let's split the data and try applying simple linear regression to this data.

Finally, let's apply polynomial regression


Report Page