FunctionRacerProblemsRace

How Much Is Explained

BeginnerstatsmodelsPython

Fit an ordinary least squares line to the points (x[i], y[i]) and return its R squared: the share of the variation in y that the line explains, from 0 to 1.

Example 1

x [0,1,2]
y [1,3,5]
returns 1.0

A perfect line explains everything.

Constraints

Race itor take your time

Write it in your browser, against the clock. The model solution, stepped through line by line, comes after.

More statsmodels problems