Recap: Sensor Glitches
Part of the Statistics for ML section of Coddy's Machine Learning journey. Lesson 28 of 64.
Challenge
MediumRemember the box plot's lonely dots? A museum's storage room sensor logs the humidity every 15 minutes into readings, and now and then it glitches.
- Print how many readings each rule flags: outside the IQR fences, and z-score beyond 3 either side.
- Cap the readings at the IQR fences, then print the mean before and after, rounded to 2 decimals.
- Draw box plots side by side, titled
Before(the readings) andAfter(capped), both with the y labelHumidity (%).
For another day's log, the program prints:
IQR glitches: 3
Z-score glitches: 2
Mean before: 51.69
Mean after: 51.89and draws this figure (Coddy then describes yours):
Try it yourself
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
log = pd.read_csv("humidity.csv")
readings = log["humidity"]
# 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 Town2Distributions
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