Skip to content

Commit 6b3b92a

Browse files
committed
update iivm scripts
1 parent 7e4e364 commit 6b3b92a

File tree

2 files changed

+93
-0
lines changed

2 files changed

+93
-0
lines changed

scripts/irm/iivm_late.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
from montecover.irm import IIVMLATECoverageSimulation
2+
3+
# Create and run simulation with config file
4+
sim = IIVMLATECoverageSimulation(
5+
config_file="scripts/irm/iivm_late_config.yml",
6+
log_level="INFO",
7+
log_file="logs/irm/iivm_late_sim.log",
8+
)
9+
sim.run_simulation()
10+
sim.save_results(output_path="results/irm/", file_prefix="iivm_late")
11+
12+
# Save config file for reproducibility
13+
sim.save_config("results/irm/iivm_late_config.yml")

scripts/irm/iivm_late_config.yml

Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
# Simulation parameters for IIVM LATE Coverage
2+
3+
simulation_parameters:
4+
repetitions: 200
5+
max_runtime: 19800 # 5.5 hours in seconds
6+
random_seed: 42
7+
n_jobs: -2
8+
9+
dgp_parameters:
10+
theta: [0.5] # Treatment effect
11+
n_obs: [500] # Sample size
12+
dim_x: [20] # Number of covariates
13+
alpha_x: [1.0] # Covariate effect
14+
15+
# Define reusable learner configurations
16+
learner_definitions:
17+
lasso: &lasso
18+
name: "LassoCV"
19+
20+
logit: &logit
21+
name: "Logistic"
22+
23+
lgbmr: &lgbmr
24+
name: "LGBM Regr."
25+
params:
26+
n_estimators: 100 # Fewer trees; with small data, fewer is often better
27+
learning_rate: 0.05 # Reasonable speed without sacrificing much accuracy
28+
num_leaves: 7 # Smaller trees reduce overfitting risk
29+
max_depth: 3 # Shallow trees generalize better on tiny datasets
30+
min_child_samples: 20 # Avoids splitting on noise
31+
subsample: 1.0 # Use all rows — subsampling adds variance with small data
32+
colsample_bytree: 0.8 # Still good to randomly drop some features per tree
33+
reg_alpha: 0.1 # L1 regularization helps when there are many features
34+
reg_lambda: 1.0 # Stronger L2 regularization improves generalization
35+
random_state: 42 # Reproducibility
36+
37+
lgbmc: &lgbmc
38+
name: "LGBM Clas."
39+
params:
40+
n_estimators: 100 # Fewer trees; with small data, fewer is often better
41+
learning_rate: 0.05 # Reasonable speed without sacrificing much accuracy
42+
num_leaves: 7 # Smaller trees reduce overfitting risk
43+
max_depth: 3 # Shallow trees generalize better on tiny datasets
44+
min_child_samples: 20 # Avoids splitting on noise
45+
subsample: 1.0 # Use all rows — subsampling adds variance with small data
46+
colsample_bytree: 0.8 # Still good to randomly drop some features per tree
47+
reg_alpha: 0.1 # L1 regularization helps when there are many features
48+
reg_lambda: 1.0 # Stronger L2 regularization improves generalization
49+
random_state: 42 # Reproducibility
50+
51+
dml_parameters:
52+
learners:
53+
- ml_g: *lasso
54+
ml_m: *logit
55+
ml_r: *logit
56+
- ml_g: *lasso
57+
ml_m: *logit
58+
ml_r: *lgbmc
59+
- ml_g: *lasso
60+
ml_m: *lgbmc
61+
ml_r: *logit
62+
- ml_g: *lasso
63+
ml_m: *lgbmc
64+
ml_r: *lgbmc
65+
- ml_g: *lgbmr
66+
ml_m: *logit
67+
ml_r: *logit
68+
- ml_g: *lgbmr
69+
ml_m: *logit
70+
ml_r: *lgbmc
71+
- ml_g: *lgbmr
72+
ml_m: *lgbmc
73+
ml_r: *logit
74+
- ml_g: *lgbmr
75+
ml_m: *lgbmc
76+
ml_r: *lgbmc
77+
78+
79+
confidence_parameters:
80+
level: [0.95, 0.90] # Confidence levels

0 commit comments

Comments
 (0)