Menu
CoddyTech

Recap: Practice Hours

Part of the Statistics for ML section of Coddy's Machine Learning journey. Lesson 40 of 64.

challenge icon

Challenge

Medium

How much weekly practice does a target score take? A language school's practice.csv holds 20 learners' hours and score; the program reads target.

  1. Fit the line predicting score from hours; print the share it explains (1 decimal).
  2. Print the hours the line needs to reach target (2 decimals).
  3. Outside the data's hours? Print a warning.
  4. Chart the Learners, the Fit over their hours and the Needed point, with a legend, axes Hours practiced and Score, and the title below.

For another school and 95:

The line explains 98.6% of the scores
Hours for a score of 95: 9.27
Warning: outside the data, which runs from 0.5 to 8.0 hours

Then Coddy describes the chart, which looks like this:

A chart titled Practice for a Score of 95: twelve learners as dots rising from 45 to 88 points between 0.5 and 8 hours, a fitted line across them, and one orange Needed dot at 9.27 hours and 95 points, past the last learner

Try it yourself

import numpy as np
import pandas as pd
import matplotlib.pyplot as plt

practice = pd.read_csv("practice.csv")
target = int(input())

# Write your code below

All lessons in Statistics for ML

Practice on your own: Online Python compiler