Prediction: your first ML idea
Frame the threshold prediction game experiment
Page 1 sets a falsifiable claim for the threshold tuner on five labeled scores before any implementation work begins.
1Try it yourself
Playground
Prediction: your first ML idea
Tune a tiny rule-based “model.” Watch accuracy change.
Mom: dinner at 7
Pred: not spam · Truth: not spam · ✓
URGENT!!! click now to WIN money
Pred: spam · Truth: spam · ✓
School homework reminder
Pred: spam · Truth: not spam · ✗
FREE FREE FREE act immediately!!!
Pred: spam · Truth: spam · ✓
2Learn the idea
Read
Name the deliverable and claim
Success is not “I followed the tutorial.” Success is producing evidence that: for a chosen threshold, accuracy and confusion counts are exact on the fixture. The accepted input is narrow on purpose: binary truths, scores in 0..1, and a threshold. That narrowness is what lets you inspect every field and prevents a toy demo from being narrated as a production system.
Record the baseline you must beat: confusion counts computed by hand at threshold 0.5. If the finished artifact cannot beat that baseline on the fixture below, stop and revise the claim before writing more code.
Read
Inventory the fixture
data=[(1,0.9),(1,0.6),(0,0.4),(0,0.2),(1,0.55)]
print({'n':len(data),'note':'tiny fixture ≠ generalization proof'})
Expected evidence: n=5 with generalization caveat. Treat the printout as a claim about this fixture, not as proof that the toolchain merely started.
Read
Spot misleading success early
For the threshold tuner on five labeled scores, a decorative win often looks like a clean run that never checks confusion matrix sums to 5; accuracy matches hand count. Write the metric down now so later pages cannot redefine success after the fact. Also note the operational threat you will eventually gate on: treating the five-row accuracy as a production SLA.
Read
Lab notebook: claim before code
For prediction-game, write the claim on a sticky note in this exact shape: “Given binary truths, scores in 0..1, and a threshold, the threshold prediction game will …”. Fill the ellipsis with the observable part of: for a chosen threshold, accuracy and confusion counts are exact on the fixture. Tape the baseline beside it: confusion counts computed by hand at threshold 0.5. If someone later replaces your metric with a vibe check, the sticky note is how you push back.
Also sketch the one-sentence user story: a person uses this output to choose a cutoff that balances errors without claiming generalization from five rows. If that sentence needs a dashboard, a model zoo, or five services, the lab scope is too wide—shrink the fixture (5 (truth, score) pairs) until the story fits on one screen.
Read
Worked judgment
Decide now whether live network calls are allowed on page 1. For this lab they usually are not; inventory and contracts should run offline against 5 (truth, score) pairs. Note the metric you will eventually require (confusion matrix sums to 5; accuracy matches hand count) so page 4 cannot invent a softer target. The characteristic failure to keep in mind is threshold outside 0..1, or reporting accuracy without TP/FP/TN/FN.
Read
Why this stage matters for the threshold prediction game
At the experiment brief stage for prediction-game, the job is narrower than finishing a product demo. You are creating one progressive evidence piece about 5 (truth, score) pairs that later pages inherit without redefining success. Keep that fixture small enough to inspect by hand, keep outputs copy-pasteable as text, and refuse to narrate this baseline as if it were a production SLA: confusion counts computed by hand at threshold 0.5.
For this page specifically, success looks like a falsifiable claim and baseline written before coding while still centering the user decision to choose a cutoff that balances errors without claiming generalization from five rows. If you cannot point to a file, command, or assertion that proves that for the threshold prediction game, stay on this page instead of advancing.
Go deeper
Before you start
Why this matters
On paper, write the user decision this lab supports: choose a cutoff that balances errors without claiming generalization from five rows. Then write one sentence naming what could look successful while actually being wrong for this claim—focus on threshold outside 0..1, or reporting accuracy without TP/FP/TN/FN. Keep both sentences beside the fixture inventory you run next.
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.