Skip to content

Commit

Permalink
allow for empty witness in SearchForCause (#491)
Browse files Browse the repository at this point in the history
* allow for empty witness in SearchForCause

* removed mwc_empty from a test

* allow empty ant and con
  • Loading branch information
rfl-urbaniak authored Jan 10, 2024
1 parent a7c7a64 commit ad4bc9c
Show file tree
Hide file tree
Showing 3 changed files with 89 additions and 269 deletions.
6 changes: 3 additions & 3 deletions chirho/explainable/handlers/explanation.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ def SearchForExplanation(
:param witnesses: A mapping from witness names to interventions or to constraints.
:param consequents: A mapping from consequent names to factor functions or to constraints.
"""
if isinstance(
if antecedents and isinstance(
next(iter(antecedents.values())),
constraints.Constraint,
):
Expand All @@ -106,7 +106,7 @@ def SearchForExplanation(
antecedents_supports = {a: constraints.boolean for a in antecedents.keys()}
# TODO generalize to non-scalar antecedents

if isinstance(
if witnesses and isinstance(
next(iter(witnesses.values())),
constraints.Constraint,
):
Expand All @@ -115,7 +115,7 @@ def SearchForExplanation(
for w, s in witnesses.items()
}

if isinstance(
if consequents and isinstance(
next(iter(consequents.values())),
constraints.Constraint,
):
Expand Down
Loading

0 comments on commit ad4bc9c

Please # to comment.