Skip to content

Commit

Permalink
fix: fixed definition bug; P(do()) = 1, rather than an exception
Browse files Browse the repository at this point in the history
  • Loading branch information
Braden Dubois committed Mar 23, 2021
1 parent 02aee82 commit c049018
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions do/structures/Probability_Engine.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,6 @@ def probability(self, head: Collection[Outcome], body: Collection[Union[Outcome,
head = set(head)
body = set(body)

# Ensure there are no adjustments/interventions in the head
for out in head:
assert not isinstance(out, Intervention), f"Error: {out} is in head; no Interventions should be in head."

# Validate the queried variables and any given
# Ensure variable is defined, outcome is possible for that variable, and it's formatted right.
for out in head | body:
Expand Down Expand Up @@ -114,6 +110,7 @@ def _compute(self, head: Collection[Outcome], body: Collection[Union[Outcome, In
self.output.detail(rep, "=", result, x=depth)
self._store_computation(rep, result)
return result

except ProbabilityException: # coverage: skip
self.output.detail("Failed to resolve by reverse product rule.", x=depth)

Expand Down Expand Up @@ -225,7 +222,7 @@ def _compute(self, head: Collection[Outcome], body: Collection[Union[Outcome, In
###############################################

# Interventions imply that we have fixed X=x
if isinstance(head[0], Intervention) and len(head) == 1 and not descendants_in_rhs: # coverage: skip
if isinstance(head[0], Intervention) and len(head) == 1 and not descendants_in_rhs:
self.output.detail("Intervention without RHS Children:", rep, "= 1.0", x=depth)
return 1.0

Expand Down

0 comments on commit c049018

Please sign in to comment.