WeCodeAcademy

Fit, Predict, Score

The full routine: split the data, fit on the training part, predict on the test part, then score. For a regression model score returns R squared: 1.0 is a perfect fit and 0 is no better than always guessing the average.

Examplepython
Open in editor »
Quick check

A score (R squared) of 1.0 means...

Your turn: write the code

Fit the model on the training data and print the test 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.