You will write four functions: the correlation coefficient, the slope and the intercept of the line of on , and a prediction. The checker tests them on data with known answers, and on data that lie exactly on a line.
The idea. Use the sums , and . Then , and .
Your tasks.
correlation(x, y).slope(x, y), the slope of the line of on .intercept(x, y).predict(x, y, new_x), which uses the line of on .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…