Skip to content

Commit f6e8b06

Browse files
black
1 parent 30f0a37 commit f6e8b06

File tree

4 files changed

+21
-9
lines changed

4 files changed

+21
-9
lines changed

causal_testing/data_collection/data_collector.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,8 +73,10 @@ def filter_valid_data(self, data: pd.DataFrame, check_pos: bool = True) -> pd.Da
7373
size_diff = len(data) - len(satisfying_data)
7474
if size_diff > 0:
7575
logger.warning(
76-
"Discarded %s/%s values due to constraint violations.\n"
77-
"For example%s", size_diff, len(data), unsat_core
76+
"Discarded %s/%s values due to constraint violations.\n" "For example%s",
77+
size_diff,
78+
len(data),
79+
unsat_core,
7880
)
7981
return satisfying_data
8082

causal_testing/generation/abstract_causal_test_case.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -103,8 +103,9 @@ def _generate_concrete_tests(
103103
optimizer.add_soft([self.scenario.variables[v].z3 == row[v] for v in run_columns])
104104
if optimizer.check() == z3.unsat:
105105
logger.warning(
106-
"Satisfiability of test case was unsat.\n"
107-
"Constraints \n %s \n Unsat core %s", optimizer, optimizer.unsat_core()
106+
"Satisfiability of test case was unsat.\n" "Constraints \n %s \n Unsat core %s",
107+
optimizer,
108+
optimizer.unsat_core(),
108109
)
109110
model = optimizer.model()
110111

causal_testing/specification/causal_dag.py

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -349,8 +349,10 @@ def adjustment_set_is_minimal(self, treatments: list[str], outcomes: list[str],
349349
proper_backdoor_graph, treatments, outcomes, smaller_adjustment_set
350350
):
351351
logger.info(
352-
"Z=%s is not minimal because Z'=Z\\{{'%s'}}="
353-
"%s is also a valid adjustment set.", adjustment_set, variable, smaller_adjustment_set
352+
"Z=%s is not minimal because Z'=Z\\{{'%s'}}=" "%s is also a valid adjustment set.",
353+
adjustment_set,
354+
variable,
355+
smaller_adjustment_set,
354356
)
355357
return False
356358

@@ -394,15 +396,21 @@ def constructive_backdoor_criterion(
394396
if not set(covariates).issubset(set(self.graph.nodes).difference(descendents_of_proper_casual_paths)):
395397
logger.info(
396398
"Failed Condition 1: Z=%s **is** a descendent of some variable on a proper causal "
397-
"path between X=%s and Y=%s.", covariates, treatments, outcomes
399+
"path between X=%s and Y=%s.",
400+
covariates,
401+
treatments,
402+
outcomes,
398403
)
399404
return False
400405

401406
# Condition (2)
402407
if not nx.d_separated(proper_backdoor_graph.graph, set(treatments), set(outcomes), set(covariates)):
403408
logger.info(
404409
"Failed Condition 2: Z=%s **does not** d-separate X=%s and Y=%s in"
405-
" the proper back-door graph relative to X and Y.", covariates, treatments, outcomes
410+
" the proper back-door graph relative to X and Y.",
411+
covariates,
412+
treatments,
413+
outcomes,
406414
)
407415
return False
408416

causal_testing/testing/causal_test_engine.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -213,7 +213,8 @@ def _check_positivity_violation(self, variables_list):
213213
"Positivity violation: missing data for variables {missing_variables}.\n"
214214
"Causal inference is only valid if a well-specified parametric model is used.\n"
215215
"Alternatively, consider restricting analysis to executions without the variables:"
216-
" %s.", missing_variables
216+
" %s.",
217+
missing_variables,
217218
)
218219
return True
219220
else:

0 commit comments

Comments
 (0)