Skip to content

Commit 6fe4b55

Browse files
committed
allow some numerical imprecision in PMF probability sum
1 parent 9a2c02c commit 6fe4b55

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

ciw/dists/distributions.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -326,7 +326,7 @@ def __init__(self, values, probs):
326326
raise ValueError("Pmf must sample positive numbers only.")
327327
if any(p < 0 or p > 1.0 for p in probs):
328328
raise ValueError("Pmf must have valid probabilities.")
329-
if sum(probs) != 1.0:
329+
if not np.isclose(sum(probs), 1.0):
330330
raise ValueError("Pmf probabilities must sum to 1.0.")
331331
self.values = values
332332
self.probs = probs

0 commit comments

Comments
 (0)