Skip to content

Commit

Permalink
Merge pull request #76 from causy-dev/unify-triple-format
Browse files Browse the repository at this point in the history
refactor(independence_tests): standardize triples, all lists now
  • Loading branch information
this-is-sofia authored Jan 29, 2025
2 parents b3f27e3 + b2282e1 commit c5e68b3
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 8 deletions.
4 changes: 1 addition & 3 deletions causy/causal_discovery/constraint/algorithms/pc.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,9 +91,7 @@
PCClassic = graph_model_factory(
Algorithm(
pipeline_steps=[
CalculatePearsonCorrelations(
display_name="Calculate Pearson Correlations"
),
CalculatePearsonCorrelations(display_name="Calculate Pearson Correlations"),
CorrelationCoefficientTest(
threshold=VariableReference(name="threshold"),
display_name="Correlation Coefficient Test",
Expand Down
16 changes: 12 additions & 4 deletions causy/causal_discovery/constraint/independence_tests/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -256,7 +256,9 @@ def process(
"triple": [
graph.nodes[nodes[0]],
graph.nodes[nodes[1]],
nodes_set - {graph.nodes[nodes[0]], graph.nodes[nodes[1]]},
list(
nodes_set - {graph.nodes[nodes[0]], graph.nodes[nodes[1]]}
),
],
},
)
Expand All @@ -269,7 +271,9 @@ def process(
"triple": [
graph.nodes[nodes[0]],
graph.nodes[nodes[1]],
nodes_set - {graph.nodes[nodes[0]], graph.nodes[nodes[1]]},
list(
nodes_set - {graph.nodes[nodes[0]], graph.nodes[nodes[1]]}
),
],
},
)
Expand Down Expand Up @@ -349,7 +353,9 @@ def process(
"triple": [
graph.nodes[nodes[0]],
graph.nodes[nodes[1]],
nodes_set - {graph.nodes[nodes[0]], graph.nodes[nodes[1]]},
list(
nodes_set - {graph.nodes[nodes[0]], graph.nodes[nodes[1]]}
),
],
},
)
Expand All @@ -362,7 +368,9 @@ def process(
"triple": [
graph.nodes[nodes[0]],
graph.nodes[nodes[1]],
nodes_set - {graph.nodes[nodes[0]], graph.nodes[nodes[1]]},
list(
nodes_set - {graph.nodes[nodes[0]], graph.nodes[nodes[1]]}
),
]
},
)
3 changes: 2 additions & 1 deletion tests/test_pc_e2e.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@
PC,
PC_ORIENTATION_RULES,
PC_GRAPH_UI_EXTENSION,
PC_DEFAULT_THRESHOLD, PCClassic,
PC_DEFAULT_THRESHOLD,
PCClassic,
)
from causy.causal_effect_estimation.multivariate_regression import (
ComputeDirectEffectsInDAGsMultivariateRegression,
Expand Down

0 comments on commit c5e68b3

Please sign in to comment.