Prediction: your first ML idea
Treat bad lists like game bugs
When the mini game breaks, reproduce the bug on purpose — empty lists and mismatched lengths are stage hazards, not mysteries.
1Learn the idea
Read
Failure modes for this toy
Common game bugs:
- Empty lists — no rounds to score; accuracy would divide by zero.
- Mismatched lengths —
zipsilently stops at the shorter list, so leftover truths or scores vanish. - Threshold outside 0..1 — a cutoff of
1.5means almost nothing ever counts as a yes. - Reporting accuracy alone — hides whether you got false alarms or misses.
These are input and rules bugs. Fix them before you accuse the guessing logic of being “random.”
Read
Keep the healthy path as your control
Always keep one known-good run so you can tell “still broken” from “fixed”:
truth = [1, 0, 1, 1, 0]
scores = [0.8, 0.3, 0.6, 0.9, 0.2]
threshold = 0.5
preds = [int(score >= threshold) for score in scores]
pairs = list(zip(truth, preds))
tp = pairs.count((1, 1)); fp = pairs.count((0, 1))
tn = pairs.count((0, 0)); fn = pairs.count((1, 0))
accuracy = (tp + tn) / len(pairs)
print(preds, f"accuracy={accuracy:.2f}", tp, fp, tn, fn)
Expected evidence:
[1, 0, 1, 1, 0] accuracy=1.00 3 0 2 0
If your “bug fix” changes this healthy output, you broke the working path while chasing a failure.
Read
Reproduce on command
In your notes, store a tiny mutant:
truth = []orscores = []→ refuse to compute accuracy.truthlength 5,scoreslength 4 → refuse or warn beforeziphides a round.threshold = 1.5→ reject as out of range.
Paste the failing message into failure-before.txt. After you add a guard, paste failure-after.txt. Retries do not help a bad list — retrying empty input just fails again.
Read
Repair with a reviewable change
A good fix is small and readable: check lengths, check ranges, then run the scoreboard. After repair, rerun the healthy fixture and confirm the expected evidence line still appears.
Go deeper
Before you start
Why this matters
Picture a classroom arcade cabinet. Someone starts a round with no scores, or pastes six truths and five scores. The screen should not quietly invent answers. Write the bug name you expect (“empty list” or “length mismatch”) and what a helpful error would say in plain kid words.
Related lessons
Check your understanding
Page assessment
Answer from memory. Completion is saved from this evidence, not from opening the next page.
All responses are required.