Polynomial Regression Introduction

It is a special case of linear regression where we can fit the polynomial equation in the data by creating the curvilinear relationship between the target variable and the independent variables.

A simple linear regression algorithm only works when it has the relationship between the data is linear. But what will happen in the case of non-linear data where linear regression will not be able to draw the best fit line and linear regression will fail in such conditions. Thus polynomial regression came into the picture to overcome this problem which finds the curvilinear relationship between dependent and independent variables.

It is a regression algorithm that makes the model with the relationship between a dependent(y) and independent variable(x) as nth degree polynomial. 

How do we use Polynomial Regression to overcome the problems of non-linear data?

As we already know Polynomial regression is nothing but a special case of linear regression in which we use a non-linear relationship between dependent and independent variables by just adding some polynomial terms to linear regression to convert it into Polynomial regression.
Now let us suppose that we have x as Independent data and y as dependent data. Then before giving data for preprocessing stage we need to convert the input variables into polynomial terms using some degree. 
For example, the input value is 35 and the degree of a polynomial is 2. So we will find 35 power 0, 35 power 1, and 35 power 2 this helps to interpret the non-linear relationship in data.
The equation of polynomial becomes something like this:

 y = a0 + a1x1 + a2x12 + … + anx1n

The degree of order is to be used as Hyperparameter, therefore we need to choose it wisely. But while using a high degree of the polynomial that tries to overfit these data and for smaller values of degree, the model tries to underfit so we need to find the optimum value of a degree.
If we see the equation of polynomial regression carefully, then we can see that we are trying to estimate the relationship between coefficients and y. While the value of x and y are already given to us, only we need to determine coefficients and the degree of coefficient here is 1 only, and degree one represents simple linear regression Hence, Polynomial regression is also known as polynomial Linear regression.

Advantages 

  • Polynomial can provide the best approximation of the relationship between the dependent and independent variables.
  • We can fit a broad range of functions under it.
  • Polynomial basically fits a wide range of curvatures.

Disadvantages 

  • The presence of one or two outliers in the data can seriously affect the results of the nonlinear analysis.
  • They are too sensitive to the outliers.