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

Skip to content

Commit 64a5d00

Browse files
committed
Add assert: gibbs_ask can't handle X in e, either.
1 parent c6f81c5 commit 64a5d00

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
@@ -439,6 +439,7 @@ def gibbs_ask(X, e, bn, N):
439439
... ).show_approx()
440440
'False: 0.738, True: 0.262'
441441
"""
442+
assert X not in e, "Query variable must be distinct from evidence"
442443
counts = dict((x, 0) for x in bn.variable_values(X)) # bold N in Fig. 14.16
443444
Z = [var for var in bn.vars if var not in e]
444445
state = dict(e) # boldface x in Fig. 14.16

0 commit comments

Comments
 (0)