
dit.util.testing.
distributions
()¶
Finding Examples¶
What if you’d like to find a distribution that has a particular property? For example, what if I’d like to find a distribution with a coinformation less that \(0.5\)? This is where Hypothesis comes in:
In [1]: In [1]: from hypothesis import find
What hypothesis has done is use the distributions()
strategy to randomly test distributions. Once it finds a distribution satisfying the criteria we specified (coinformation less than \(0.5\)) it then simplifies the example as much as possible. Here, we see that even though it could have found any distribution, it found the exclusive or distribution, and simplified the probabilities to be uniform.