@@ -107,10 +107,10 @@ def test_data_adequacy_cateogorical(self):
107
107
{"kurtosis" : {"test_input_no_dist[T.b]" : 0.0 }, "bootstrap_size" : 100 , "passing" : 100 },
108
108
)
109
109
110
- def test_dag_adequacy (self ):
110
+ def test_dag_adequacy_dependent (self ):
111
111
base_test_case = BaseTestCase (
112
112
treatment_variable = "test_input" ,
113
- outcome_variable = "test_output " ,
113
+ outcome_variable = "B " ,
114
114
effect = None ,
115
115
)
116
116
causal_test_case = CausalTestCase (
@@ -128,29 +128,127 @@ def test_dag_adequacy(self):
128
128
{
129
129
"causal_dag" : self .json_class .causal_specification .causal_dag ,
130
130
"test_suite" : test_suite ,
131
- "tested_pairs" : {("test_input" , "test_output " )},
131
+ "tested_pairs" : {("test_input" , "B " )},
132
132
"pairs_to_test" : {
133
+ ("B" , "C" ),
133
134
("test_input_no_dist" , "test_input" ),
135
+ ("C" , "test_output" ),
134
136
("test_input" , "B" ),
135
- ("test_input_no_dist" , "C" ),
136
137
("test_input_no_dist" , "B" ),
138
+ ("test_input" , "test_output" ),
137
139
("test_input" , "C" ),
138
- ("B" , "C" ),
139
140
("test_input_no_dist" , "test_output" ),
141
+ ("B" , "test_output" ),
142
+ ("test_input_no_dist" , "C" ),
143
+ },
144
+ "untested_pairs" : {
145
+ ("B" , "C" ),
146
+ ("test_input_no_dist" , "test_input" ),
147
+ ("C" , "test_output" ),
148
+ ("test_input_no_dist" , "B" ),
140
149
("test_input" , "test_output" ),
150
+ ("test_input" , "C" ),
151
+ ("test_input_no_dist" , "test_output" ),
152
+ ("B" , "test_output" ),
153
+ ("test_input_no_dist" , "C" ),
154
+ },
155
+ "dag_adequacy" : 0.1 ,
156
+ },
157
+ )
158
+
159
+ def test_dag_adequacy_independent (self ):
160
+ base_test_case = BaseTestCase (
161
+ treatment_variable = "test_input" ,
162
+ outcome_variable = "C" ,
163
+ effect = None ,
164
+ )
165
+ causal_test_case = CausalTestCase (
166
+ base_test_case = base_test_case ,
167
+ expected_causal_effect = None ,
168
+ estimate_type = None ,
169
+ )
170
+ test_suite = CausalTestSuite ()
171
+ test_suite .add_test_object (base_test_case , causal_test_case , None , None )
172
+ dag_adequacy = DAGAdequacy (self .json_class .causal_specification .causal_dag , test_suite )
173
+ dag_adequacy .measure_adequacy ()
174
+ print (dag_adequacy .to_dict ())
175
+ self .assertEqual (
176
+ dag_adequacy .to_dict (),
177
+ {
178
+ "causal_dag" : self .json_class .causal_specification .causal_dag ,
179
+ "test_suite" : test_suite ,
180
+ "tested_pairs" : {("test_input" , "C" )},
181
+ "pairs_to_test" : {
182
+ ("B" , "C" ),
183
+ ("test_input_no_dist" , "test_input" ),
141
184
("C" , "test_output" ),
185
+ ("test_input" , "B" ),
186
+ ("test_input_no_dist" , "B" ),
187
+ ("test_input" , "test_output" ),
188
+ ("test_input" , "C" ),
189
+ ("test_input_no_dist" , "test_output" ),
142
190
("B" , "test_output" ),
191
+ ("test_input_no_dist" , "C" ),
143
192
},
144
- "untested_edges" : {
193
+ "untested_pairs" : {
194
+ ("B" , "C" ),
145
195
("test_input_no_dist" , "test_input" ),
196
+ ("C" , "test_output" ),
197
+ ("test_input_no_dist" , "B" ),
198
+ ("test_input" , "test_output" ),
146
199
("test_input" , "B" ),
200
+ ("test_input_no_dist" , "test_output" ),
201
+ ("B" , "test_output" ),
147
202
("test_input_no_dist" , "C" ),
203
+ },
204
+ "dag_adequacy" : 0.1 ,
205
+ },
206
+ )
207
+
208
+ def test_dag_adequacy_independent_other_way (self ):
209
+ base_test_case = BaseTestCase (
210
+ treatment_variable = "C" ,
211
+ outcome_variable = "test_input" ,
212
+ effect = None ,
213
+ )
214
+ causal_test_case = CausalTestCase (
215
+ base_test_case = base_test_case ,
216
+ expected_causal_effect = None ,
217
+ estimate_type = None ,
218
+ )
219
+ test_suite = CausalTestSuite ()
220
+ test_suite .add_test_object (base_test_case , causal_test_case , None , None )
221
+ dag_adequacy = DAGAdequacy (self .json_class .causal_specification .causal_dag , test_suite )
222
+ dag_adequacy .measure_adequacy ()
223
+ print (dag_adequacy .to_dict ())
224
+ self .assertEqual (
225
+ dag_adequacy .to_dict (),
226
+ {
227
+ "causal_dag" : self .json_class .causal_specification .causal_dag ,
228
+ "test_suite" : test_suite ,
229
+ "tested_pairs" : {("test_input" , "C" )},
230
+ "pairs_to_test" : {
231
+ ("B" , "C" ),
232
+ ("test_input_no_dist" , "test_input" ),
233
+ ("C" , "test_output" ),
234
+ ("test_input" , "B" ),
148
235
("test_input_no_dist" , "B" ),
236
+ ("test_input" , "test_output" ),
149
237
("test_input" , "C" ),
150
- ("B" , "C" ),
151
238
("test_input_no_dist" , "test_output" ),
239
+ ("B" , "test_output" ),
240
+ ("test_input_no_dist" , "C" ),
241
+ },
242
+ "untested_pairs" : {
243
+ ("B" , "C" ),
244
+ ("test_input_no_dist" , "test_input" ),
152
245
("C" , "test_output" ),
246
+ ("test_input_no_dist" , "B" ),
247
+ ("test_input" , "test_output" ),
248
+ ("test_input" , "B" ),
249
+ ("test_input_no_dist" , "test_output" ),
153
250
("B" , "test_output" ),
251
+ ("test_input_no_dist" , "C" ),
154
252
},
155
253
"dag_adequacy" : 0.1 ,
156
254
},
0 commit comments