An outlier moves a mean more than a median

Take the same three training times and change just the longest.

Take the same three training times and change just the longest. Compare how much the mean and median constants move before deciding which error matters to you.

Work through the example

For 2, 4 and 6 both are 4 seconds. Replacing 6 with 24 moves the mean to 10; the median stays 4.

Run the example as a separate Python file. The inputs are synthetic so you can change them and see exactly which assumption affects the result.

Run the example

from statistics import mean, median
for times in [[2, 4, 6], [2, 4, 24]]:
    print(mean(times), median(times))

Expected output

4 4
10 4

Reference: https://docs.python.org/3/library/statistics.html

The team guide · My original notes on testing coding agents · Working with Lightbulb Partners