liveBook · Manning

Polynomial regression

As explained in Grokking Machine Learning

A regression model whose predicted outcome is expressed as a polynomial function of its input features.

Polynomial regression fits curved functions to data that a straight line cannot model well. A polynomial combines powers of an input, and its degree is the highest power used. section 3.6 section 3.9

Figure 3.26 Polynomial regression is useful when it comes to modeling nonlinear data. If our data looks like the left part of the figure, it will be hard to find a line that fits it well. However, a curve will fit the data well, as you can see in the right part of the figure. Polynomial regression helps us find this curve.

Compare how a curve can fit nonlinear data better than a line. section 3.6

For a one-feature dataset, a Turi Create workflow is to:

  • Add columns for powers of the feature, then fit linear regression to the expanded dataset. section 4.6
  • Split the data into training and test sets, optionally set L1 or L2 penalties, and predict on the test set. section 4.6

Fitting a parabola

A dataset shaped like a downward-opening parabola is modeled by adding powers of x and fitting linear regression. The demonstrated comparison uses no regularization, L1 regularization, and L2 regularization. section 4.6

How Grokking Machine Learning covers it

How deep it goes
Defines polynomial degree, then demonstrates power-feature expansion, linear fitting, regularization, and test-set prediction.
Examples
Uses polynomial-degree plots and a downward-opening parabola dataset with unregularized, L1-, and L2-regularized fits.
What it assumes
Builds on linear regression’s line-fitting idea and defines polynomials and degree before applying them.
What you can do after
Apply via Turi Create by adding feature powers, fitting linear regression, and predicting on a held-out test set.
How it connects
Connects polynomial regression to linear regression, regularization, and training/testing splits.

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Grokking Machine Learning. The section links point to the parts of the book it draws on.