Skip to content

Commit e753b1e

Browse files
committed
_adjustment_set_from_formula now uses a set rather than a sorted list
1 parent 1318ec3 commit e753b1e

3 files changed

Lines changed: 4 additions & 4 deletions

File tree

causal_testing/estimation/abstract_regression_estimator.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ def _adjustment_set_from_formula(self):
101101
tree = ast.parse(code, mode="eval")
102102
adjustment_set = adjustment_set.union(self._get_adjusted_variables(tree))
103103

104-
self.adjustment_set = sorted(list(adjustment_set))
104+
self.adjustment_set = adjustment_set
105105

106106
def _setup_covariates(self, df: pd.DataFrame) -> pd.Series:
107107
"""

causal_testing/estimation/linear_regression_estimator.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ def gp_formula(
3333
seed: int = 0,
3434
):
3535
# pylint: disable=too-many-arguments
36-
"""
36+
r"""
3737
Use Genetic Programming (GP) to infer the regression equation from the data.
3838
3939
:param df: The data to use.

tests/estimation_tests/test_linear_regression_estimator.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ def test_complex_formula_adjustment_set(self):
7171
linear_regression_estimator = LinearRegressionEstimator(
7272
treatment_variable="cut", outcome_variable="price", formula=formula
7373
)
74-
self.assertEqual(linear_regression_estimator.adjustment_set, ["C", "color", "depth"])
74+
self.assertEqual(linear_regression_estimator.adjustment_set, {"C", "color", "depth"})
7575

7676
def test_complex_formula_adjustment_set_no_c(self):
7777
"""
@@ -81,7 +81,7 @@ def test_complex_formula_adjustment_set_no_c(self):
8181
linear_regression_estimator = LinearRegressionEstimator(
8282
treatment_variable="cut", outcome_variable="price", formula=formula
8383
)
84-
self.assertEqual(linear_regression_estimator.adjustment_set, ["caret", "color"])
84+
self.assertEqual(linear_regression_estimator.adjustment_set, {"caret", "color"})
8585

8686
def test_complex_formula_adjustment_set_no_dependent(self):
8787
"""

0 commit comments

Comments
 (0)