Recap: Practice Hours
Part of the Statistics for ML section of Coddy's Machine Learning journey. Lesson 40 of 64.
Challenge
MediumHow much weekly practice does a target score take? A language school's practice.csv holds 20 learners' hours and score; the program reads target.
- Fit the line predicting
scorefromhours; print the share it explains (1 decimal). - Print the hours the line needs to reach
target(2 decimals). - Outside the data's hours? Print a warning.
- Chart the
Learners, theFitover their hours and theNeededpoint, with a legend, axesHours practicedandScore, 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 hoursThen Coddy describes the chart, which looks like this:
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
1Center and Spread
Mean and MedianPercentiles and QuartilesVariance and StdSample or Population?The Most Common ValueRecap: Delivery Times4Samples and Populations
Population and SampleSample Means VaryThe Sampling DistributionBigger Samples, Less NoiseRecap: Polling a Town7Trend Lines
ResidualsLeast Squares FitDrawing the FitPredicting with a LineHow Good Is the Fit?Recap: Practice Hours2Distributions
Density HistogramsShapes of DataThe Normal CurveThe 68-95-99.7 RuleZ-ScoresRecap: Battery Life3Probability by Simulation
Probability as FrequencyThe Law of Large NumbersSums of DiceExpected ValueConditional ProbabilityRecap: Dice Stall Odds6Relationships
Reading Scatter PlotsCorrelationCorrelation MatrixCorrelation HeatmapsCorrelation Is Not CauseRecap: Ice Cream and SunPractice on your own: Online Python compiler