Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit b504f00

Browse files
committed
Patched bug: enumeration_joint_ask gave wrong answers when the query variable overlaps the evidence.
1 parent 98f1d13 commit b504f00

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

probability.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,7 @@ def enumerate_joint_ask(X, e, P):
120120
>>> enumerate_joint_ask('X', dict(Y=1), P).show_approx()
121121
'0: 0.667, 1: 0.167, 2: 0.167'
122122
"""
123+
assert X not in e, "Query variable must be distinct from evidence"
123124
Q = ProbDist(X) # probability distribution for X, initially empty
124125
Y = [v for v in P.variables if v != X and v not in e] # hidden vars.
125126
for xi in P.values(X):

0 commit comments

Comments
 (0)