Skip to content

Commit

Permalink
Bug fix: discrete uniform icdf.
Browse files Browse the repository at this point in the history
  • Loading branch information
gokuld committed Apr 29, 2023
1 parent a158f7e commit 22d2ad6
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion pymc/distributions/discrete.py
Original file line number Diff line number Diff line change
Expand Up @@ -1063,7 +1063,7 @@ def logcdf(value, lower, upper):
)

def icdf(value, lower, upper):
res = pt.ceil(value * (upper - lower + 1)).astype("int64") + lower - 1
res = pt.ceil(value * (upper - lower + 1) + lower - 1).astype("int64")
res_1m = pt.maximum(res - 1, lower)
dist = pm.DiscreteUniform.dist(lower=lower, upper=upper)
value_1m = pt.exp(logcdf(dist, res_1m))
Expand Down

0 comments on commit 22d2ad6

Please sign in to comment.