Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fix cardinality
There was two errors.
The integer bounds are inclusive, but the cardinality was computed as if
the upper bound was exclusive.
The shape affects cardinality exponentially, it would be
(cardinality of one item) ** prod(shape), not (cardinality of one item) * prod(shape).
Fix casting of Integer
Why:
There is a mismatch between the inclusive bound of Integer and
the underlying distribution (which is real) where high is in theory exclusive
but in practice inclusive due to limited precision and rounding.
We cannot use numpy.round() to fix this because otherwise the probability
is changed for lowest and highest possible numbers. For instance a
uniform distribution (0, 10) would have a probability of 0.5 * (1/10)
for 0 instead of (1/10).
How:
In the cast method, rescale the point from (low, high) to
(low, high + 1) before computing the numpy.floor().astype(int).
Note that some distributions have infinite intervals, in which case we
do no rescaling.
Deprecate
randint
distributionuniform(a, b, discrete=True) and randint(a, b) handles differently the intervals are
seems incompatible. We were already recommending uniform over randint
anyway.