Skip to content

Commit dab90a9

Browse files
committed
add did cs multi simulation scripts
1 parent 3cec82b commit dab90a9

File tree

2 files changed

+78
-0
lines changed

2 files changed

+78
-0
lines changed

scripts/did/did_cs_multi.py

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

scripts/did/did_cs_multi_config.yml

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
# Simulation parameters for DID Multi Coverage
2+
3+
simulation_parameters:
4+
repetitions: 10
5+
max_runtime: 19800 # 5.5 hours in seconds
6+
random_seed: 42
7+
n_jobs: -2
8+
9+
dgp_parameters:
10+
DGP: [1, 4, 6] # Different DGP specifications
11+
n_obs: [2000] # Sample size for each simulation (has to be a list)
12+
lambda_t: [0.5]
13+
14+
# Define reusable learner configurations
15+
learner_definitions:
16+
linear: &linear
17+
name: "Linear"
18+
19+
logistic: &logistic
20+
name: "Logistic"
21+
22+
lgbmr: &lgbmr
23+
name: "LGBM Regr."
24+
params:
25+
n_estimators: 300 # More trees to learn slowly and steadily
26+
learning_rate: 0.03 # Lower learning rate to improve generalization
27+
num_leaves: 7 # Fewer leaves — simpler trees
28+
max_depth: 3 # Shallow trees reduce overfitting
29+
min_child_samples: 20 # Require more samples per leaf
30+
subsample: 0.8 # More row sampling to add randomness
31+
colsample_bytree: 0.8 # More feature sampling
32+
reg_alpha: 0.1 # Add L1 regularization
33+
reg_lambda: 1.0 # Increase L2 regularization
34+
random_state: 42 # Reproducible
35+
36+
lgbmc: &lgbmc
37+
name: "LGBM Clas."
38+
params:
39+
n_estimators: 300 # More trees to learn slowly and steadily
40+
learning_rate: 0.03 # Lower learning rate to improve generalization
41+
num_leaves: 7 # Fewer leaves — simpler trees
42+
max_depth: 3 # Shallow trees reduce overfitting
43+
min_child_samples: 20 # Require more samples per leaf
44+
subsample: 0.8 # More row sampling to add randomness
45+
colsample_bytree: 0.8 # More feature sampling
46+
reg_alpha: 0.1 # Add L1 regularization
47+
reg_lambda: 1.0 # Increase L2 regularization
48+
random_state: 42 # Reproducible
49+
50+
dml_parameters:
51+
# ML methods for ml_g and ml_m
52+
learners:
53+
- ml_g: *linear
54+
ml_m: *logistic
55+
- ml_g: *lgbmr
56+
ml_m: *lgbmc
57+
58+
score:
59+
- observational # Standard DML score
60+
- experimental # Experimental score (no propensity estimation)
61+
62+
in_sample_normalization: [true, false]
63+
64+
confidence_parameters:
65+
level: [0.95, 0.90] # Confidence levels

0 commit comments

Comments
 (0)