Skip to content

Commit

Permalink
Add capture for zero probability condition.
Browse files Browse the repository at this point in the history
  • Loading branch information
Feras A. Saad committed May 29, 2020
1 parent 4426991 commit 545dfe7
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions src/spn.py
Original file line number Diff line number Diff line change
Expand Up @@ -253,6 +253,7 @@ def logprob_factored__(self, event_factor, memo):
def condition_factored__(self, event_factor, memo):
logps_condt = [spn.logprob_factored(event_factor, memo) for spn in self.children]
indexes = [i for i, lp in enumerate(logps_condt) if not isinf_neg(lp)]
assert indexes, 'Conditioning event "%s" has probability zero' % (str(event_factor),)
logps_joint = [logps_condt[i] + self.weights[i] for i in indexes]
children = [self.children[i].condition_factored(event_factor, memo) for i in indexes]
weights = lognorm(logps_joint)
Expand Down

0 comments on commit 545dfe7

Please sign in to comment.