Better for Which Cases?
Most readings come from the day shift. A model can improve its overall score while getting worse at night. Keep group sizes beside group errors before calling that a repair.
13 sections · 3 questions · 1 coding challenge
The arrow keys move between sections too.
A Model Report Needs to Say Who Was Measured
BOTIE
We will use shifts in an invented greenhouse. The calculation is small enough to inspect, while the reporting question also applies to devices, locations and carefully defined population groups.
Sources for this history
The Day Shift Is Drowning Out the Night Shift
Botie’s revised temperature model improves on most readings. The night team disagrees: their predictions are worse. Both observations can be true if the evaluation contains far more daytime readings.
Let’s keep the same error calculation and change how we group its results. We want to see who benefits from the revision and where we still need evidence.
Invented readings. One mutually exclusive shift label per observation is used here; real evaluation slices can overlap.
Step 1 of 2
A smaller overall error can conceal a regression
The same four readings are used for both versions.
| Reading | Shift | Baseline absolute error | Candidate absolute error |
|---|---|---|---|
| A | day | 2 | 1 |
| B | day | 2 | 1 |
| C | day | 2 | 1 |
| D | night | 2 | 4 |
A
- Shift
- day
- Baseline absolute error
- 2
- Candidate absolute error
- 1
B
- Shift
- day
- Baseline absolute error
- 2
- Candidate absolute error
- 1
C
- Shift
- day
- Baseline absolute error
- 2
- Candidate absolute error
- 1
D
- Shift
- night
- Baseline absolute error
- 2
- Candidate absolute error
- 4
Step 2 of 2
Keep the sample size beside the metric
The aggregate weights each reading equally, so daytime receives most of the weight.
| Report | Count | Baseline MAE | Candidate MAE |
|---|---|---|---|
| All readings | 4 | 2 | 1.75 |
| Day | 3 | 2 | 1 |
| Night | 1 | 2 | 4 |
All readings
- Count
- 4
- Baseline MAE
- 2
- Candidate MAE
- 1.75
Day
- Count
- 3
- Baseline MAE
- 2
- Candidate MAE
- 1
Night
- Count
- 1
- Baseline MAE
- 2
- Candidate MAE
- 4
The denominator determines whose errors dominate
The earlier residual calculation survives. Grouping changes which errors are averaged together.
Keep the night readings visible
Calculate one absolute error per reading, then aggregate within the supplied shift names.
BOTIE
Errors by shift
[
{
"group": "day",
"n": 2,
"mae": 1
},
{
"group": "night",
"n": 2,
"mae": 1
}
]Follow the operations
1. Observed temperatures
- 010
- 110
- 210
- 310
2. Predicted temperatures
- 09
- 19
- 29
- 39
3. Observed minus predicted
- 01
- 11
- 21
- 31
4. Keep the size of each error
- 01
- 11
- 21
- 31
5. Shift for each reading
- 0day
- 1night
- 2day
- 3night
6. Keep the error beside its group
[ { "group": "day", "n": 2, "mae": 1 }, { "group": "night", "n": 2, "mae": 1 } ]7. Result
[ { "group": "day", "n": 2, "mae": 1 }, { "group": "night", "n": 2, "mae": 1 } ]
Counts and means alone do not quantify uncertainty, establish fairness or explain the cause of a group difference.
1. Keep the comparison on the same observations
Retain an ID, an observed outcome and both predictions for every evaluation case. Attach the shift from the original record. Compute absolute error before aggregating.
If the candidate’s report excludes a failed night prediction, its lower average may come from removing a difficult case. Count missing outputs separately and require the declared evaluation set to remain accounted for.
The workshop assumes complete aligned predictions. In a production report, missing results need their own explicit status.
2. Choose slices for a reason
A slice is a subset defined by a condition, such as night readings or a particular sensor model. Start with conditions that matter to the task and are available in the evaluation data. Record the definitions before comparing candidates.
Exploring additional slices can reveal a problem you did not anticipate. Mark that as a discovery to confirm on new evidence. Searching hundreds of tiny slices and presenting only the worst or best result can create misleading certainty.
Night slice: shift == "night"
Day slice: shift == "day"For people-related groups, the labels, collection process and reporting choices need particular care. An error comparison alone does not establish a complete fairness claim.
Check yourself
Questions on Parts 1 to 2
Question 1 of 1
Which statement is supported?
Use the information below.
Baseline errors [2,2,2,2]; candidate errors [1,1,1,4]. Shifts [day,day,day,night].3. Distinguish equal readings from equal groups
Overall MAE weights every observation equally. A macro average of group MAEs weights every group equally, regardless of how many observations it contains. Both can be useful, but they describe different target populations.
For disjoint groups covering the dataset, weighting each group MAE by its count recovers the overall MAE. Overlapping slices cannot simply be added this way because some observations would be counted more than once.
Candidate group MAEs: day = 1, night = 4
Observation-weighted MAE = (3 × 1 + 1 × 4) / 4 = 1.75
Equal-group MAE = (1 + 4) / 2 = 2.5Name the averaging rule. Changing the weights is a decision about which population or cost the report represents.
4. Small slices need visible uncertainty
A group with one observation can produce a dramatic number without telling us how stable it is. Report the count and, where appropriate, an uncertainty interval based on the actual independent sampling units. Repeated readings from one greenhouse do not become independent buildings because they occupy separate rows.
Do not silently suppress a small slice’s failure. Mark the evidence as limited and decide what additional observations would help distinguish a persistent problem from one unusual case.
No observations means no measured performance. Display “not evaluated” rather than a perfect score.
5. Use a mask to preserve group membership
The groups array names the shift at each position. Comparing it with one group name creates a Boolean mask. Apply that mask to the error array, then reduce the selected values.
A Python dictionary preserves first-seen key order. We use that to keep reports predictable without hard-coding that only day and night can occur.
The reusable challenge must handle a new group name as well as a new number of readings.
Inspect the night slice directly
The example extracts a group before calculating its mean.
import numpy as np
errors = np.array([1., 2., 5.])
groups = np.array(["day", "night", "night"])
selected = errors[groups == "night"]
print(selected.tolist())
print(float(selected.mean()))[2.0, 5.0]
3.5The daytime error never enters the night denominator.
6. Turn a group regression into a testable repair
Inspect the night cases. Perhaps the heater behaves differently after sunset, or the sensor measures a different part of the room. A plausible missing feature gives us something specific to test.
Keep day performance in the comparison while developing the repair. Declare acceptable group regressions and minimum evidence before the final assessment. A tiny apparent gain should not automatically excuse a large error where the system is most needed.
The later model iteration project combines this report with paired gains and runtime requirements.
Check yourself
Questions on Parts 1 to 6
Question 1 of 2
Its measured error should be reported as zero.
Consider this example.
A night slice has no observations in the assessment.Try it with Botie
Build with Botie
Write and run Python