Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
## Summary
What does this PR do?

## Main file changes
Summarise changes to main files to be reviewed.

## Checklist
Before you mark your PR as ready for review, please ensure you have completed the following.

Expand Down
9 changes: 5 additions & 4 deletions causal_testing/discovery/hill_climber_discovery.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,16 +103,17 @@ def evaluate_fitness(
)
return fitness_values, problem_edges

def discover(self) -> CausalDAG:
def discover(self, individual: CausalDAG = None) -> CausalDAG:
"""
Discover the causal DAG.

:returns: The inferred causal DAG.
"""

individual = CausalDAG(ignore_cycles=True)
individual.add_nodes_from(self.df.columns)
individual.add_edges_from(self.possible_edges)
if individual is None:
individual = CausalDAG(ignore_cycles=True)
individual.add_nodes_from(self.df.columns)
individual.add_edges_from(self.possible_edges)
self.remove_cycles(individual)
fitness_values, problem_edges = self.evaluate_fitness(individual)

Expand Down
2 changes: 1 addition & 1 deletion causal_testing/estimation/linear_regression_estimator.py
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ def estimate_ate_calculated(self, df: pd.DataFrame) -> EffectEstimate:
return EffectEstimate("ate", pd.Series(treatment_outcome["mean"] - control_outcome["mean"]), ci_low, ci_high)

def _get_confidence_intervals(self, model, treatment):
confidence_intervals = model.conf_int(alpha=self.alpha, cols=None)
confidence_intervals = model.conf_int(alpha=self.alpha)
ci_low, ci_high = (
pd.Series(confidence_intervals[0].loc[treatment]),
pd.Series(confidence_intervals[1].loc[treatment]),
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ dependencies = [
"pandas>=2.1",
"scikit_learn~=1.4",
"scipy>=1.12.0,<=1.17.1",
"statsmodels~=0.14",
"statsmodels~=0.15",
"tabulate~=0.9",
"pydot>=2.0",
"pygad~=3.3",
Expand Down
2 changes: 1 addition & 1 deletion tests/discovery_tests/test_abstract_discovery.py
Original file line number Diff line number Diff line change
Expand Up @@ -274,7 +274,7 @@ def test_evaluate_tests_inestimable(self):
"outcome": "completed",
},
{
"result": TestOutcome.INESTIMABLE,
"result": TestOutcome.PASS,
"expected_effect": "NoEffect",
"treatment": "color",
"outcome": "completed",
Expand Down
12 changes: 6 additions & 6 deletions tests/main_tests/test_ctf.py
Original file line number Diff line number Diff line change
Expand Up @@ -197,14 +197,14 @@ def test_ctf_evaluate_dag_inestimable(self):
expected = pd.Series(
{
"FAIL": 1,
"FAIL_ci_high": 2,
"FAIL_ci_high": 1,
"FAIL_ci_low": 0,
"INESTIMABLE": 1,
"INESTIMABLE_ci_high": 1,
"INESTIMABLE": 0,
"INESTIMABLE_ci_high": 0,
"INESTIMABLE_ci_low": 0,
"PASS": 4,
"PASS_ci_high": 4,
"PASS_ci_low": 0,
"PASS": 5,
"PASS_ci_high": 5,
"PASS_ci_low": 2,
}
).sort_index()
pd.testing.assert_series_equal(results, expected)
Loading