Skip to content

Commit 044fe26

Browse files
author
AndrewC19
committed
Documentation for metamorphic relation generation improved.
1 parent 6123999 commit 044fe26

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

causal_testing/specification/metamorphic_relation.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,10 @@ def generate_metamorphic_relations(dag: CausalDAG) -> list[MetamorphicRelation]:
174174
"""Construct a list of metamorphic relations implied by the Causal DAG.
175175
176176
This list of metamorphic relations contains a ShouldCause relation for every edge, and a ShouldNotCause
177-
relation for every conditional independence relation.
177+
relation for every (minimal) conditional independence relation implied by the structure of the DAG.
178+
179+
:param CausalDAG dag: Causal DAG from which the metamorphic relations will be generated.
180+
:return: A list containing ShouldCause and ShouldNotCause metamorphic relations.
178181
"""
179182
metamorphic_relations = []
180183
for node_pair in combinations(dag.graph.nodes, 2):
@@ -193,7 +196,7 @@ def generate_metamorphic_relations(dag: CausalDAG) -> list[MetamorphicRelation]:
193196
adj_set = list(dag.direct_effect_adjustment_sets([v], [u])[0])
194197
metamorphic_relations.append(ShouldNotCause(v, u, adj_set, dag))
195198

196-
# Case 3: V _||_ U (neither is a predecessor)
199+
# Case 3: V _||_ U (No directed walk from V to U but there may be a back-door path e.g. U <-- Z --> V).
197200
# Only make one MR since V _||_ U == U _||_ V
198201
else:
199202
adj_set = list(dag.direct_effect_adjustment_sets([u], [v])[0])

0 commit comments

Comments
 (0)