Premium problem103. Will the Test Set Agree?

Medium Locked

A classifier's true accuracy is p. You measure it on n independent examples. Return the probability the measured accuracy comes out at least threshold.

The number correct is Binomial(n,p)\mathrm{Binomial}(n, p), so sum from ⌈n⋅threshold⌉\lceil n \cdot \text{threshold} \rceil upwards. On a small test set this is uncomfortably far from certain even when the model is genuinely good.

Input

n = 100
p = 0.9
threshold = 0.85

Output

0.9601094728889168

Premium problem

This one's part of Premium. Unlock the full Probability track plus every other premium problem on the site.

Implement solve(...)