Course contentsShow
← Data Science
Lesson 657 of 2,14517. Categorical Predictors and InteractionsFree lesson

What Are Polynomial Features?

Learn how polynomial features transform linear models to capture non-linear relationships through squared and higher-order terms.

What Are Polynomial Features?

You'll learn: How to extend linear regression to model curves and non-linear patterns by adding squared, cubed, and higher-power terms of your predictors.

The Core Idea

So far, you've worked with linear models where each predictor has a straight-line relationship with the outcome. But what if your data curves? What if sales don't increase steadily with advertising spend, but accelerate or plateau?

Polynomial features let you capture these curves within a linear regression framework by adding powers of your existing variables.

From Lines to Curves

Imagine you have a single predictor X. A simple linear model is:

y = β₀ + β₁X

This draws a straight line. But if you add a squared term, you get:

y = β₀ + β₁X + β₂X²

Now you can fit a parabola—a curve that bends up or down. Add a cubic term (X³) and you can model even more complex shapes with multiple bends.

Why This Matters

Real-world relationships often aren't linear. Temperature affects plant growth up to a point, then harms it. Economic returns diminish. By transforming your linear model with polynomial features, you gain flexibility to capture these non-linear patterns without abandoning regression entirely.

The model is still "linear" in its coefficients (β₀, β₁, β₂), which means you can still use ordinary least squares estimation—you're just feeding it richer features.

When to Use Polynomial Features

Check your residual plots. If you see curved patterns, polynomial terms might help. Start with quadratic (X²), then try cubic if needed—but beware overfitting with very high degrees.

Key Takeaway: Polynomial features transform your predictors by adding squared, cubed, or higher-order terms, allowing linear regression to model curved, non-linear relationships while keeping estimation straightforward.