You will write the least-squares slope and intercept from the sums about the means, and a prediction function. The checker uses the canteen data and compares with the statistics module.
The idea. , where and . Then , and a prediction is .
Your tasks.
slope(xs, ys).intercept(xs, ys). Use slope.predict(xs, ys, x).Have you tried it?
Do the tasks in the editor first, and run the checker after each one. Its hints help when a check fails. When you are ready, compare your code with this solution.
Log in to join the discussion.
Loading…