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 |
1 |
6 |
7 |
2 |
8 |
9 |
3 |
10 |
13 |
4 |
14 |
17.5 |
5 |
18 |
18 |
Â
Testing instance | ...