Code RoomAccuracy misleads on imbalanced data
MediumPrep Room Coding #4217

Accuracy misleads on imbalanced data

Vibe & agenticAlgorithms & data structuresMid–Senior~15 min

An AI wrote this evaluation for a rare-disease classifier (about 1.5% positive). It prints 98.6% accuracy and the assistant calls the model 'highly performant.' What's wrong?

Implement
evaluate_rare_class(y_true: list[int], y_pred: list[int]) → list[float]
Examples
in[[1,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0,0]]out[0.9,0,0,0.9]
in[[1,1,0,0,0,0,0,0,0,0],[1,0,0,0,0,0,0,0,0,1]]out[0.8,0.5,0.5,0.8]
in[[1,0,1,0],[1,0,1,0]]out[1,1,1,0.5]
What a strong answer looks like

Treat the AI’s output as a draft to verify, not an answer to trust. Name the specific flaw and the input that triggers it, say how you’d catch it (tests, edge cases, reading critically), and how you’d re-prompt or decompose to get it right.

0:00 of about 15 min

Vibe & agentic: describe the solution in plain language (or narrate it) and the coach grades your approach.

Which questions mattered is sealed until you submit. Telling you now would just be handing over the edge cases.