"18 of 20 passed, so the bot is 90% accurate" is a sentence every AI team has said and should not. With 20 cases, the true pass rate could easily be anywhere from about 70% to 97%. A pass rate is an estimate, and an estimate needs a range.
The Wilson score interval is the usual choice for pass rates. It behaves well with small samples and at 0% or 100%, where the textbook "plus or minus" formula breaks. For k passes out of n, with p = k/n and z = 1.96 for 95%:
centre = (p + z²/2n) / (1 + z²/n) half = z · √( p(1−p)/n + z²/4n² ) / (1 + z²/n) interval = centre − half to centre + half
Notice what happens as n grows: the same 90% gives a much narrower range with 400 cases than with 20.
Your task
Choose one way to do it:
- Python: implement
wilson(). Run prints the intervals forcounts.json. On submit it also runs on counts you have not seen, including all-pass and all-fail. - No code: use the calculator and enter the four intervals below as percentages with one decimal place.