Skip to content

Commit a68556d

Browse files
committed
Addressed comments
1 parent f87cf52 commit a68556d

File tree

3 files changed

+5
-5
lines changed

3 files changed

+5
-5
lines changed

causal_testing/testing/causal_test_engine.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ def _return_causal_test_results(self, estimator, causal_test_case):
147147
:return: a CausalTestResult object containing the confidence intervals
148148
"""
149149
if not hasattr(estimator, f"estimate_{causal_test_case.estimate_type}"):
150-
raise NotImplementedError(f"{estimator.__class__} has no {causal_test_case.estimate_type} method.")
150+
raise AttributeError(f"{estimator.__class__} has no {causal_test_case.estimate_type} method.")
151151
estimate_effect = getattr(estimator, f"estimate_{causal_test_case.estimate_type}")
152152
effect, confidence_intervals = estimate_effect(**causal_test_case.estimate_params)
153153
causal_test_result = CausalTestResult(

causal_testing/testing/estimators.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -495,7 +495,7 @@ def add_modelling_assumptions(self):
495495
(iii) Instrument and outcome do not share causes
496496
"""
497497

498-
def estimate_coefficient_aux(self, df):
498+
def estimate_iv_coefficient(self, df):
499499
"""
500500
Estimate the linear regression coefficient of the treatment on the
501501
outcome.
@@ -515,13 +515,13 @@ def estimate_coefficient(self, bootstrap_size=100):
515515
outcome.
516516
"""
517517
bootstraps = sorted(
518-
[self.estimate_coefficient_aux(self.df.sample(len(self.df), replace=True)) for _ in range(bootstrap_size)]
518+
[self.estimate_iv_coefficient(self.df.sample(len(self.df), replace=True)) for _ in range(bootstrap_size)]
519519
)
520520
bound = ceil((bootstrap_size * self.alpha) / 2)
521521
ci_low = bootstraps[bound]
522522
ci_high = bootstraps[bootstrap_size - bound]
523523

524-
return self.estimate_coefficient_aux(self.df), (ci_low, ci_high)
524+
return self.estimate_iv_coefficient(self.df), (ci_low, ci_high)
525525

526526

527527
class CausalForestEstimator(Estimator):

tests/testing_tests/test_causal_test_engine.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -220,7 +220,7 @@ def test_invalid_estimate_type(self):
220220
self.causal_test_engine.scenario_execution_data_df,
221221
)
222222
self.causal_test_case.estimate_type = "invalid"
223-
with self.assertRaises(NotImplementedError):
223+
with self.assertRaises(AttributeError):
224224
self.causal_test_engine.execute_test(estimation_model, self.causal_test_case)
225225

226226
def test_execute_test_observational_linear_regression_estimator_squared_term(self):

0 commit comments

Comments
 (0)