Polynomial Regression

noun

say it: “pol-ee-NOH-mee-ul rih-GRESH-un” /ˌpɑliˈnoʊmiəl rɪˈɡrɛʃən/

Fitting a curved line to data by giving a linear model the squares or higher powers of its inputs as extra inputs.

What is polynomial regression?

Polynomial regression is linear regression given polynomial features, such as rainfall and rainfall², so its guesses follow a curve. A low degree, such as 2, bends once; a high degree can wiggle through every point and overfit.

from sklearn.pipeline import make_pipeline
from sklearn.preprocessing import PolynomialFeatures
from sklearn.linear_model import LinearRegression
rain = [[10], [20], [30], [40], [50]]        # inches
apples = [100, 160, 180, 160, 100]        # bushels: up, then down
model = make_pipeline(PolynomialFeatures(degree=2), LinearRegression()).fit(rain, apples)
print(model.predict([[30]]).round())   # [180.]

In a sentence

  • “A degree-10 polynomial regression wiggled through every point and failed on new orchards.”
  • “Polynomial regression caught the rise and fall of the harvest that a straight line missed.”

Level: Journeyman · More AI Basics terms at this level

Updated