@@ -33,38 +33,45 @@ def __eq__(self, other):
3333 same_adjustment_set = set (self .adjustment_vars ) == set (other .adjustment_vars )
3434 return same_type and same_treatment and same_outcome and same_effect and same_adjustment_set
3535
36-
37- class ShouldCause (MetamorphicRelation ):
38- """Class representing a should cause metamorphic relation."""
39-
4036 def to_json_stub (
4137 self ,
4238 skip : bool = False ,
4339 estimate_type : str = "coefficient" ,
4440 effect_type : str = "direct" ,
4541 estimator : str = "LinearRegressionEstimator" ,
42+ alpha : float = 0.05 ,
4643 ) -> dict :
4744 """
4845 Convert to a JSON frontend stub string for user customisation.
4946 :param skip: Whether to skip the test (default False).
5047 :param effect_type: The type of causal effect to consider (total or direct)
5148 :param estimate_type: The estimate type to use when evaluating tests
5249 :param estimator: The name of the estimator class to use when evaluating the test
50+ :param alpha: The significance level to use when calculating the confidence intervals
5351 """
5452 return {
5553 "name" : str (self ),
5654 "estimator" : estimator ,
5755 "estimate_type" : estimate_type ,
5856 "effect" : effect_type ,
5957 "treatment_variable" : self .base_test_case .treatment_variable ,
60- "expected_effect" : {self .base_test_case .outcome_variable : "SomeEffect" },
6158 "formula" : (
6259 f"{ self .base_test_case .outcome_variable } ~ "
6360 f"{ ' + ' .join ([self .base_test_case .treatment_variable ] + self .adjustment_vars )} "
6461 ),
62+ "alpha" : alpha ,
6563 "skip" : skip ,
6664 }
6765
66+
67+ class ShouldCause (MetamorphicRelation ):
68+ """Class representing a should cause metamorphic relation."""
69+
70+ def to_json_stub (self , ** kwargs ):
71+ return super ().to_json_stub (** kwargs ) | {
72+ "expected_effect" : {self .base_test_case .outcome_variable : "SomeEffect" },
73+ }
74+
6875 def __str__ (self ):
6976 formatted_str = f"{ self .base_test_case .treatment_variable } --> { self .base_test_case .outcome_variable } "
7077 if self .adjustment_vars :
@@ -75,33 +82,9 @@ def __str__(self):
7582class ShouldNotCause (MetamorphicRelation ):
7683 """Class representing a should cause metamorphic relation."""
7784
78- def to_json_stub (
79- self ,
80- skip : bool = False ,
81- estimate_type : str = "coefficient" ,
82- effect_type : str = "direct" ,
83- estimator : str = "LinearRegressionEstimator" ,
84- ) -> dict :
85- """
86- Convert to a JSON frontend stub string for user customisation.
87- :param skip: Whether to skip the test (default False).
88- :param effect_type: The type of causal effect to consider (total or direct)
89- :param estimate_type: The estimate type to use when evaluating tests
90- :param estimator: The name of the estimator class to use when evaluating the test
91- """
92- return {
93- "name" : str (self ),
94- "estimator" : estimator ,
95- "estimate_type" : estimate_type ,
96- "effect" : effect_type ,
97- "treatment_variable" : self .base_test_case .treatment_variable ,
85+ def to_json_stub (self , ** kwargs ):
86+ return super ().to_json_stub (** kwargs ) | {
9887 "expected_effect" : {self .base_test_case .outcome_variable : "NoEffect" },
99- "formula" : (
100- f"{ self .base_test_case .outcome_variable } ~ "
101- f"{ ' + ' .join ([self .base_test_case .treatment_variable ] + self .adjustment_vars )} "
102- ),
103- "alpha" : 0.05 ,
104- "skip" : skip ,
10588 }
10689
10790 def __str__ (self ):
0 commit comments