WeCodeAcademy

Fitting Curves

A straight line cannot follow a curve. PolynomialFeatures adds the squared (and higher) versions of each feature so a linear model can bend. A pipeline chains steps, so the same steps run on training data and on new data.

Examplepython
Open in editor »
Quick check

What does `PolynomialFeatures(2)` add?

Your turn: write the code

Fit a degree 3 polynomial pipeline to these points and print its score rounded to 3 decimals.

Finish the quick check (and any code exercise) to complete this lesson, or mark it done yourself.

Tip: use the left and right arrow keys to move between lessons.