Skip to content

Commit f35d661

Browse files
committed
add plr sim
1 parent dc0c612 commit f35d661

File tree

5 files changed

+359
-19
lines changed

5 files changed

+359
-19
lines changed

monte-cover/src/montecover/plm/plr_ate.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ def _convert_ml_string_to_object(self, ml_string):
5151
elif ml_string == "Random Forest":
5252
learner = RandomForestRegressor(n_estimators=100, max_features=20, max_depth=5, min_samples_leaf=2)
5353
elif ml_string == "LGBM":
54-
learner = LGBMRegressor(n_estimators=100, learning_rate=0.05, verbose=-1)
54+
learner = LGBMRegressor(n_estimators=100, learning_rate=0.05, verbose=-1, n_jobs=1)
5555
else:
5656
raise ValueError(f"Unknown learner type: {ml_string}")
5757

results/plm/plr_ate_config.yml

Lines changed: 332 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,332 @@
1+
confidence_parameters:
2+
level:
3+
- 0.95
4+
- 0.9
5+
dgp_parameters:
6+
dim_x:
7+
- 20
8+
n_obs:
9+
- 500
10+
theta:
11+
- 0.5
12+
dml_parameters:
13+
learners:
14+
- ml_g: !!python/tuple
15+
- Lasso
16+
- !!python/object:sklearn.linear_model._coordinate_descent.LassoCV
17+
_sklearn_version: 1.5.2
18+
alphas: null
19+
copy_X: true
20+
cv: null
21+
eps: 0.001
22+
fit_intercept: true
23+
max_iter: 1000
24+
n_alphas: 100
25+
n_jobs: null
26+
positive: false
27+
precompute: auto
28+
random_state: null
29+
selection: cyclic
30+
tol: 0.0001
31+
verbose: false
32+
ml_m: !!python/tuple
33+
- Lasso
34+
- !!python/object:sklearn.linear_model._coordinate_descent.LassoCV
35+
_sklearn_version: 1.5.2
36+
alphas: null
37+
copy_X: true
38+
cv: null
39+
eps: 0.001
40+
fit_intercept: true
41+
max_iter: 1000
42+
n_alphas: 100
43+
n_jobs: null
44+
positive: false
45+
precompute: auto
46+
random_state: null
47+
selection: cyclic
48+
tol: 0.0001
49+
verbose: false
50+
- ml_g: !!python/tuple
51+
- Random Forest
52+
- !!python/object:sklearn.ensemble._forest.RandomForestRegressor
53+
_sklearn_version: 1.5.2
54+
bootstrap: true
55+
ccp_alpha: 0.0
56+
class_weight: null
57+
criterion: squared_error
58+
estimator: !!python/object:sklearn.tree._classes.DecisionTreeRegressor
59+
_sklearn_version: 1.5.2
60+
ccp_alpha: 0.0
61+
class_weight: null
62+
criterion: squared_error
63+
max_depth: null
64+
max_features: null
65+
max_leaf_nodes: null
66+
min_impurity_decrease: 0.0
67+
min_samples_leaf: 1
68+
min_samples_split: 2
69+
min_weight_fraction_leaf: 0.0
70+
monotonic_cst: null
71+
random_state: null
72+
splitter: best
73+
estimator_params: &id001 !!python/tuple
74+
- criterion
75+
- max_depth
76+
- min_samples_split
77+
- min_samples_leaf
78+
- min_weight_fraction_leaf
79+
- max_features
80+
- max_leaf_nodes
81+
- min_impurity_decrease
82+
- random_state
83+
- ccp_alpha
84+
- monotonic_cst
85+
max_depth: 5
86+
max_features: 20
87+
max_leaf_nodes: null
88+
max_samples: null
89+
min_impurity_decrease: 0.0
90+
min_samples_leaf: 2
91+
min_samples_split: 2
92+
min_weight_fraction_leaf: 0.0
93+
monotonic_cst: null
94+
n_estimators: 100
95+
n_jobs: null
96+
oob_score: false
97+
random_state: null
98+
verbose: 0
99+
warm_start: false
100+
ml_m: !!python/tuple
101+
- Random Forest
102+
- !!python/object:sklearn.ensemble._forest.RandomForestRegressor
103+
_sklearn_version: 1.5.2
104+
bootstrap: true
105+
ccp_alpha: 0.0
106+
class_weight: null
107+
criterion: squared_error
108+
estimator: !!python/object:sklearn.tree._classes.DecisionTreeRegressor
109+
_sklearn_version: 1.5.2
110+
ccp_alpha: 0.0
111+
class_weight: null
112+
criterion: squared_error
113+
max_depth: null
114+
max_features: null
115+
max_leaf_nodes: null
116+
min_impurity_decrease: 0.0
117+
min_samples_leaf: 1
118+
min_samples_split: 2
119+
min_weight_fraction_leaf: 0.0
120+
monotonic_cst: null
121+
random_state: null
122+
splitter: best
123+
estimator_params: *id001
124+
max_depth: 5
125+
max_features: 20
126+
max_leaf_nodes: null
127+
max_samples: null
128+
min_impurity_decrease: 0.0
129+
min_samples_leaf: 2
130+
min_samples_split: 2
131+
min_weight_fraction_leaf: 0.0
132+
monotonic_cst: null
133+
n_estimators: 100
134+
n_jobs: null
135+
oob_score: false
136+
random_state: null
137+
verbose: 0
138+
warm_start: false
139+
- ml_g: !!python/tuple
140+
- Lasso
141+
- !!python/object:sklearn.linear_model._coordinate_descent.LassoCV
142+
_sklearn_version: 1.5.2
143+
alphas: null
144+
copy_X: true
145+
cv: null
146+
eps: 0.001
147+
fit_intercept: true
148+
max_iter: 1000
149+
n_alphas: 100
150+
n_jobs: null
151+
positive: false
152+
precompute: auto
153+
random_state: null
154+
selection: cyclic
155+
tol: 0.0001
156+
verbose: false
157+
ml_m: !!python/tuple
158+
- Random Forest
159+
- !!python/object:sklearn.ensemble._forest.RandomForestRegressor
160+
_sklearn_version: 1.5.2
161+
bootstrap: true
162+
ccp_alpha: 0.0
163+
class_weight: null
164+
criterion: squared_error
165+
estimator: !!python/object:sklearn.tree._classes.DecisionTreeRegressor
166+
_sklearn_version: 1.5.2
167+
ccp_alpha: 0.0
168+
class_weight: null
169+
criterion: squared_error
170+
max_depth: null
171+
max_features: null
172+
max_leaf_nodes: null
173+
min_impurity_decrease: 0.0
174+
min_samples_leaf: 1
175+
min_samples_split: 2
176+
min_weight_fraction_leaf: 0.0
177+
monotonic_cst: null
178+
random_state: null
179+
splitter: best
180+
estimator_params: *id001
181+
max_depth: 5
182+
max_features: 20
183+
max_leaf_nodes: null
184+
max_samples: null
185+
min_impurity_decrease: 0.0
186+
min_samples_leaf: 2
187+
min_samples_split: 2
188+
min_weight_fraction_leaf: 0.0
189+
monotonic_cst: null
190+
n_estimators: 100
191+
n_jobs: null
192+
oob_score: false
193+
random_state: null
194+
verbose: 0
195+
warm_start: false
196+
- ml_g: !!python/tuple
197+
- Random Forest
198+
- !!python/object:sklearn.ensemble._forest.RandomForestRegressor
199+
_sklearn_version: 1.5.2
200+
bootstrap: true
201+
ccp_alpha: 0.0
202+
class_weight: null
203+
criterion: squared_error
204+
estimator: !!python/object:sklearn.tree._classes.DecisionTreeRegressor
205+
_sklearn_version: 1.5.2
206+
ccp_alpha: 0.0
207+
class_weight: null
208+
criterion: squared_error
209+
max_depth: null
210+
max_features: null
211+
max_leaf_nodes: null
212+
min_impurity_decrease: 0.0
213+
min_samples_leaf: 1
214+
min_samples_split: 2
215+
min_weight_fraction_leaf: 0.0
216+
monotonic_cst: null
217+
random_state: null
218+
splitter: best
219+
estimator_params: *id001
220+
max_depth: 5
221+
max_features: 20
222+
max_leaf_nodes: null
223+
max_samples: null
224+
min_impurity_decrease: 0.0
225+
min_samples_leaf: 2
226+
min_samples_split: 2
227+
min_weight_fraction_leaf: 0.0
228+
monotonic_cst: null
229+
n_estimators: 100
230+
n_jobs: null
231+
oob_score: false
232+
random_state: null
233+
verbose: 0
234+
warm_start: false
235+
ml_m: !!python/tuple
236+
- Lasso
237+
- !!python/object:sklearn.linear_model._coordinate_descent.LassoCV
238+
_sklearn_version: 1.5.2
239+
alphas: null
240+
copy_X: true
241+
cv: null
242+
eps: 0.001
243+
fit_intercept: true
244+
max_iter: 1000
245+
n_alphas: 100
246+
n_jobs: null
247+
positive: false
248+
precompute: auto
249+
random_state: null
250+
selection: cyclic
251+
tol: 0.0001
252+
verbose: false
253+
- ml_g: !!python/tuple
254+
- LGBM
255+
- !!python/object:lightgbm.sklearn.LGBMRegressor
256+
_Booster: null
257+
_best_iteration: -1
258+
_best_score: {}
259+
_class_map: null
260+
_class_weight: null
261+
_classes: null
262+
_evals_result: {}
263+
_n_classes: -1
264+
_n_features: -1
265+
_n_features_in: -1
266+
_objective: null
267+
_other_params:
268+
verbose: -1
269+
boosting_type: gbdt
270+
class_weight: null
271+
colsample_bytree: 1.0
272+
importance_type: split
273+
learning_rate: 0.05
274+
max_depth: -1
275+
min_child_samples: 20
276+
min_child_weight: 0.001
277+
min_split_gain: 0.0
278+
n_estimators: 100
279+
n_jobs: 1
280+
num_leaves: 31
281+
objective: null
282+
random_state: null
283+
reg_alpha: 0.0
284+
reg_lambda: 0.0
285+
subsample: 1.0
286+
subsample_for_bin: 200000
287+
subsample_freq: 0
288+
verbose: -1
289+
ml_m: !!python/tuple
290+
- LGBM
291+
- !!python/object:lightgbm.sklearn.LGBMRegressor
292+
_Booster: null
293+
_best_iteration: -1
294+
_best_score: {}
295+
_class_map: null
296+
_class_weight: null
297+
_classes: null
298+
_evals_result: {}
299+
_n_classes: -1
300+
_n_features: -1
301+
_n_features_in: -1
302+
_objective: null
303+
_other_params:
304+
verbose: -1
305+
boosting_type: gbdt
306+
class_weight: null
307+
colsample_bytree: 1.0
308+
importance_type: split
309+
learning_rate: 0.05
310+
max_depth: -1
311+
min_child_samples: 20
312+
min_child_weight: 0.001
313+
min_split_gain: 0.0
314+
n_estimators: 100
315+
n_jobs: 1
316+
num_leaves: 31
317+
objective: null
318+
random_state: null
319+
reg_alpha: 0.0
320+
reg_lambda: 0.0
321+
subsample: 1.0
322+
subsample_for_bin: 200000
323+
subsample_freq: 0
324+
verbose: -1
325+
score:
326+
- partialling out
327+
- IV-type
328+
simulation_parameters:
329+
max_runtime: 19800
330+
n_jobs: -2
331+
random_seed: 42
332+
repetitions: 1000

results/plm/plr_ate_coverage.csv

Lines changed: 21 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,21 @@
1-
Learner g,Learner m,score,level,Coverage,CI Length,Bias,repetition
2-
Lasso,Lasso,IV-type,0.9,0.881,0.1393979255576113,0.0352891099128789,1000
3-
Lasso,Lasso,IV-type,0.95,0.945,0.16610287331091153,0.0352891099128789,1000
4-
Lasso,Lasso,partialling out,0.9,0.908,0.14646362984437974,0.034686755904342816,1000
5-
Lasso,Lasso,partialling out,0.95,0.956,0.17452217926042807,0.034686755904342816,1000
6-
Lasso,Random Forest,IV-type,0.9,0.895,0.14672332096879584,0.03621404411832195,1000
7-
Lasso,Random Forest,IV-type,0.95,0.953,0.17483162032109167,0.03621404411832195,1000
8-
Lasso,Random Forest,partialling out,0.9,0.816,0.14332193251141256,0.04209132271298422,1000
9-
Lasso,Random Forest,partialling out,0.95,0.888,0.17077861599008798,0.04209132271298422,1000
10-
Random Forest,Lasso,IV-type,0.9,0.883,0.14193144590758777,0.03591650651278451,1000
11-
Random Forest,Lasso,IV-type,0.95,0.951,0.16912174900823193,0.03591650651278451,1000
12-
Random Forest,Lasso,partialling out,0.9,0.901,0.1519648979095884,0.03615745065828101,1000
13-
Random Forest,Lasso,partialling out,0.95,0.952,0.181077344474182,0.03615745065828101,1000
14-
Random Forest,Random Forest,IV-type,0.9,0.893,0.14942288181113228,0.03672076481604481,1000
15-
Random Forest,Random Forest,IV-type,0.95,0.948,0.17804834546815554,0.03672076481604481,1000
16-
Random Forest,Random Forest,partialling out,0.9,0.878,0.14635785065361873,0.037417599679567926,1000
17-
Random Forest,Random Forest,partialling out,0.95,0.946,0.17439613558042621,0.037417599679567926,1000
1+
Learner g,Learner m,Score,level,Coverage,CI Length,Bias
2+
LGBM,LGBM,IV-type,0.9,0.881,0.16045495852616187,0.041395241786732526
3+
LGBM,LGBM,IV-type,0.95,0.929,0.19119387567330545,0.041395241786732526
4+
LGBM,LGBM,partialling out,0.9,0.843,0.14699796562424566,0.042234936165735856
5+
LGBM,LGBM,partialling out,0.95,0.91,0.17515887961298732,0.042234936165735856
6+
Lasso,Lasso,IV-type,0.9,0.88,0.139906736409111,0.03566583231811613
7+
Lasso,Lasso,IV-type,0.95,0.935,0.16670915883537538,0.03566583231811613
8+
Lasso,Lasso,partialling out,0.9,0.895,0.14682161377285347,0.03567834426028154
9+
Lasso,Lasso,partialling out,0.95,0.94,0.1749487434211267,0.03567834426028154
10+
Lasso,Random Forest,IV-type,0.9,0.886,0.14706644661357227,0.03746782142897475
11+
Lasso,Random Forest,IV-type,0.95,0.94,0.17524047974475984,0.03746782142897475
12+
Lasso,Random Forest,partialling out,0.9,0.806,0.14380399961661133,0.04440852985313324
13+
Lasso,Random Forest,partialling out,0.95,0.869,0.1713530343753106,0.04440852985313324
14+
Random Forest,Lasso,IV-type,0.9,0.878,0.14220975326271637,0.03662484099631004
15+
Random Forest,Lasso,IV-type,0.95,0.933,0.16945337267598382,0.03662484099631004
16+
Random Forest,Lasso,partialling out,0.9,0.893,0.15213074253257877,0.03746402925271374
17+
Random Forest,Lasso,partialling out,0.95,0.948,0.18127496053117625,0.03746402925271374
18+
Random Forest,Random Forest,IV-type,0.9,0.886,0.14967937696801667,0.037873686545345016
19+
Random Forest,Random Forest,IV-type,0.95,0.94,0.17835397829861846,0.037873686545345016
20+
Random Forest,Random Forest,partialling out,0.9,0.878,0.14693420687636086,0.03830834442193379
21+
Random Forest,Random Forest,partialling out,0.95,0.934,0.17508290637895235,0.03830834442193379

results/plm/plr_ate_metadata.csv

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
DoubleML Version,Script,Date,Total Runtime (minutes),Python Version,Config File
2+
0.10.dev0,PLRATECoverageSimulation,2025-03-21 15:10,12.47926504611969,3.12.9,scripts/plm/plr_ate_config.yml

0 commit comments

Comments
 (0)