Skip to content

Commit beb9547

Browse files
committed
Removed exception handling in causal test case to catch it further up the chain
1 parent f505dd7 commit beb9547

File tree

1 file changed

+7
-15
lines changed

1 file changed

+7
-15
lines changed

causal_testing/testing/causal_test_case.py

Lines changed: 7 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -81,21 +81,13 @@ def _return_causal_test_results(self, estimator) -> CausalTestResult:
8181
if not hasattr(estimator, f"estimate_{self.estimate_type}"):
8282
raise AttributeError(f"{estimator.__class__} has no {self.estimate_type} method.")
8383
estimate_effect = getattr(estimator, f"estimate_{self.estimate_type}")
84-
try:
85-
effect, confidence_intervals = estimate_effect(**self.estimate_params)
86-
return CausalTestResult(
87-
estimator=estimator,
88-
test_value=TestValue(self.estimate_type, effect),
89-
effect_modifier_configuration=self.effect_modifier_configuration,
90-
confidence_intervals=confidence_intervals,
91-
)
92-
except np.linalg.LinAlgError:
93-
return CausalTestResult(
94-
estimator=estimator,
95-
test_value=TestValue(self.estimate_type, None),
96-
effect_modifier_configuration=self.effect_modifier_configuration,
97-
confidence_intervals=None,
98-
)
84+
effect, confidence_intervals = estimate_effect(**self.estimate_params)
85+
return CausalTestResult(
86+
estimator=estimator,
87+
test_value=TestValue(self.estimate_type, effect),
88+
effect_modifier_configuration=self.effect_modifier_configuration,
89+
confidence_intervals=confidence_intervals,
90+
)
9991

10092
def __str__(self):
10193
treatment_config = {self.treatment_variable.name: self.treatment_value}

0 commit comments

Comments
 (0)