@@ -19,7 +19,7 @@ def __init__(self, llm=None):
19
19
# self,
20
20
# treatment: str,
21
21
# outcome: str,
22
- # factors_list : list(),
22
+ # all_factors : list(),
23
23
# llm: guidance.models,
24
24
# backdoor: Set[str] = None,
25
25
# frontdoor: Set[str] = None,
@@ -41,7 +41,7 @@ def __init__(self, llm=None):
41
41
# backdoor_edges, backdoor_set = self.suggest_backdoor(
42
42
# treatment=treatment,
43
43
# outcome=outcome,
44
- # factors_list=factors_list ,
44
+ # all_factors=all_factors ,
45
45
# llm=llm,
46
46
# experts=experts,
47
47
# analysis_context=analysis_context,
@@ -66,7 +66,7 @@ def __init__(self, llm=None):
66
66
# frontdoor_edges, frontdoor_set = self.suggest_frontdoor(
67
67
# treatment=treatment,
68
68
# outcome=outcome,
69
- # factors_list=factors_list ,
69
+ # all_factors=all_factors ,
70
70
# llm=llm,
71
71
# experts=experts,
72
72
# analysis_context=analysis_context,
@@ -87,7 +87,7 @@ def __init__(self, llm=None):
87
87
# ivs_edges, ivs_set = self.suggest_ivs(
88
88
# treatment=treatment,
89
89
# outcome=outcome,
90
- # factors_list=factors_list ,
90
+ # all_factors=all_factors ,
91
91
# llm=llm,
92
92
# experts=experts,
93
93
# analysis_context=analysis_context,
@@ -116,15 +116,15 @@ def suggest_backdoor(
116
116
self ,
117
117
treatment : str ,
118
118
outcome : str ,
119
- factors_list : list (),
119
+ all_factors : list (),
120
120
expertise_list : list (),
121
- analysis_context = CONTEXT ,
121
+ analysis_context : str = CONTEXT ,
122
122
stakeholders : list () = None
123
123
):
124
124
backdoor_set = self .model_suggester .suggest_confounders (
125
125
treatment = treatment ,
126
126
outcome = outcome ,
127
- factors_list = factors_list ,
127
+ all_factors = all_factors ,
128
128
expertise_list = expertise_list ,
129
129
analysis_context = analysis_context ,
130
130
stakeholders = stakeholders
@@ -136,9 +136,9 @@ def suggest_frontdoor(
136
136
self ,
137
137
treatment : str ,
138
138
outcome : str ,
139
- factors_list : list (),
139
+ all_factors : list (),
140
140
expertise_list : list (),
141
- analysis_context = CONTEXT ,
141
+ analysis_context : str = CONTEXT ,
142
142
stakeholders : list () = None
143
143
):
144
144
pass
@@ -147,9 +147,9 @@ def suggest_mediators(
147
147
self ,
148
148
treatment : str ,
149
149
outcome : str ,
150
- factors_list : list (),
150
+ all_factors : list (),
151
151
expertise_list : list (),
152
- analysis_context = CONTEXT ,
152
+ analysis_context : str = CONTEXT ,
153
153
stakeholders : list () = None
154
154
):
155
155
expert_list : List [str ] = list ()
@@ -164,16 +164,16 @@ def suggest_mediators(
164
164
mediators_edges [(treatment , outcome )] = 1
165
165
166
166
edited_factors_list : List [str ] = []
167
- for i in range (len (factors_list )):
168
- if factors_list [i ] != treatment and factors_list [i ] != outcome :
169
- edited_factors_list .append (factors_list [i ])
167
+ for i in range (len (all_factors )):
168
+ if all_factors [i ] != treatment and all_factors [i ] != outcome :
169
+ edited_factors_list .append (all_factors [i ])
170
170
171
171
for expert in expert_list :
172
172
mediators_edges , mediators_list = self .request_mediators (
173
173
treatment = treatment ,
174
174
outcome = outcome ,
175
175
domain_expertise = expert ,
176
- factors_list = edited_factors_list ,
176
+ all_factors = edited_factors_list ,
177
177
mediators_edges = mediators_edges ,
178
178
analysis_context = analysis_context
179
179
)
@@ -187,9 +187,9 @@ def request_mediators(
187
187
treatment ,
188
188
outcome ,
189
189
domain_expertise ,
190
- factors_list ,
190
+ all_factors ,
191
191
mediators_edges ,
192
- analysis_context = CONTEXT
192
+ analysis_context : str = CONTEXT
193
193
):
194
194
mediators : List [str ] = list ()
195
195
@@ -218,7 +218,7 @@ def request_mediators(
218
218
on the causal chain that links the { treatment } to the { outcome } ? From your perspective as an expert in
219
219
{ domain_expertise } , which factor(s) of the following factors, if any at all, mediates, is/are on the causal
220
220
chain, that links the { treatment } to the { outcome } ? Then provide your step by step chain of thoughts within
221
- the tags <thinking></thinking>. factor_names : { factors_list } Wrap the name of the factor(s), if any at all,
221
+ the tags <thinking></thinking>. factor_names : { all_factors } Wrap the name of the factor(s), if any at all,
222
222
that has/have a high likelihood of directly influencing and causing the assignment of the { outcome } and also
223
223
has/have a high likelihood of being directly influenced and caused by the assignment of the { treatment } within
224
224
the tags <mediating_factor>factor_name</mediating_factor>. Where factor_name is one of the items within the
@@ -237,7 +237,7 @@ def request_mediators(
237
237
if mediating_factor :
238
238
for factor in mediating_factor :
239
239
# to not add it twice into the list
240
- if factor in factors_list and factor not in mediators :
240
+ if factor in all_factors and factor not in mediators :
241
241
mediators .append (factor )
242
242
success = True
243
243
@@ -262,9 +262,9 @@ def suggest_ivs(
262
262
self ,
263
263
treatment : str ,
264
264
outcome : str ,
265
- factors_list : list (),
265
+ all_factors : list (),
266
266
expertise_list : list (),
267
- analysis_context = CONTEXT ,
267
+ analysis_context : str = CONTEXT ,
268
268
stakeholders : list () = None
269
269
):
270
270
expert_list : List [str ] = list ()
@@ -279,17 +279,17 @@ def suggest_ivs(
279
279
iv_edges [(treatment , outcome )] = 1
280
280
281
281
edited_factors_list : List [str ] = []
282
- for i in range (len (factors_list )):
283
- if factors_list [i ] != treatment and factors_list [i ] != outcome :
284
- edited_factors_list .append (factors_list [i ])
282
+ for i in range (len (all_factors )):
283
+ if all_factors [i ] != treatment and all_factors [i ] != outcome :
284
+ edited_factors_list .append (all_factors [i ])
285
285
286
286
for expert in expert_list :
287
287
iv_edges , iv_list = self .request_ivs (
288
288
treatment = treatment ,
289
289
outcome = outcome ,
290
290
analysis_context = analysis_context ,
291
291
domain_expertise = expert ,
292
- factors_list = edited_factors_list ,
292
+ all_factors = edited_factors_list ,
293
293
iv_edges = iv_edges ,
294
294
)
295
295
@@ -305,7 +305,7 @@ def request_ivs(
305
305
outcome ,
306
306
analysis_context ,
307
307
domain_expertise ,
308
- factors_list ,
308
+ all_factors ,
309
309
iv_edges
310
310
):
311
311
ivs : List [str ] = list ()
@@ -338,7 +338,7 @@ def request_ivs(
338
338
the { outcome } ? Which factor(s) of the following factors, if any at all, are (an) instrumental variable(s)
339
339
to the causal relationship of the { treatment } causing the { outcome } ? Be concise and keep your thinking
340
340
within two paragraphs. Then provide your step by step chain of thoughts within the tags
341
- <thinking></thinking>. factor_names : { factors_list } Wrap the name of the factor(s), if there are any at
341
+ <thinking></thinking>. factor_names : { all_factors } Wrap the name of the factor(s), if there are any at
342
342
all, that both has/have a high likelihood of influecing and causing the { treatment } and has/have a very low
343
343
likelihood of influencing and causing the { outcome } , within the tags <iv_factor>factor_name</iv_factor>.
344
344
Where factor_name is one of the items within the factor_names list. If a factor does not have a high
@@ -353,7 +353,7 @@ def request_ivs(
353
353
354
354
if iv_factors :
355
355
for factor in iv_factors :
356
- if factor in factors_list and factor not in ivs :
356
+ if factor in all_factors and factor not in ivs :
357
357
ivs .append (factor )
358
358
success = True
359
359
0 commit comments