Skip to content

Commit 75efc80

Browse files
authored
Updated IV check to explicitly use len
1 parent f5400ee commit 75efc80

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

causal_testing/specification/causal_dag.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -173,8 +173,8 @@ def check_iv_assumptions(self, treatment, outcome, instrument) -> bool:
173173
(
174174
cause
175175
for cause in self.graph.nodes
176-
if list(nx.all_simple_paths(self.graph, source=cause, target=instrument))
177-
and list(nx.all_simple_paths(self.graph, source=cause, target=outcome))
176+
if len(list(nx.all_simple_paths(self.graph, source=cause, target=instrument))) > 0
177+
and len(list(nx.all_simple_paths(self.graph, source=cause, target=outcome))) > 0
178178
)
179179
):
180180
raise ValueError(f"Instrument {instrument} and outcome {outcome} share common causes")

0 commit comments

Comments
 (0)