Premium problem89. Catching an Informative Feature

Medium Locked

A random forest picks m distinct features at random out of d, of which r are genuinely informative. Return the probability the split sees at least one informative feature.

Complement again: count the ways to choose m features entirely from the d - r useless ones.

P(at least one)=1−(d−rm)(dm)P(\text{at least one}) = 1 - \frac{\binom{d-r}{m}}{\binom{d}{m}}

Input

d = 100
r = 10
m = 10

Output

0.6695237889132748

Premium problem

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

Implement solve(...)