Polynomial regression
In the previous examples, we assumed that the real relationship between the explanatory variables and the response variable is linear. In this section, we will use polynomial regression, a special case of multiple linear regression that models a linear relationship between the response variable and polynomial feature terms. The real-world curvilinear relationship is captured by transforming the features, which are then fit in the same manner as in multiple linear regression. For ease of visualization, we will again use only one explanatory variable, the pizza's diameter, in this section. Let's compare linear regression with polynomial regression using the following datasets:
Training instance | Diameter in inches | Price in dollars |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Â
Testing instance | Diameter in inches | Price in dollars |
|
|
|
|
|
|
|
|
|
|
|
|
Â
Quadratic regression, or regression with a second-order polynomial, is given by the following:
Note that we are using only one feature for one explanatory...