Skip to content

Commit 375333c

Browse files
committed
add tuning results to docs
1 parent 454361c commit 375333c

File tree

3 files changed

+222
-3
lines changed

3 files changed

+222
-3
lines changed

doc/irm/apo.qmd

Lines changed: 120 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,9 @@ from utils.style_tables import generate_and_show_styled_table
2222
init_notebook_mode(all_interactive=True)
2323
```
2424

25-
## APO Pointwise Coverage
25+
## Coverage
26+
27+
### APO Pointwise Coverage
2628

2729
The simulations are based on the the [make_irm_data_discrete_treatments](https://docs.doubleml.org/stable/api/datasets.html#dataset-generators)-DGP with $500$ observations. Due to the linearity of the DGP, Lasso and Logit Regression are nearly optimal choices for the nuisance estimation.
2830

@@ -78,7 +80,7 @@ generate_and_show_styled_table(
7880
```
7981

8082

81-
## APOS Coverage
83+
### APOS Coverage
8284

8385
The simulations are based on the the [make_irm_data_discrete_treatments](https://docs.doubleml.org/stable/api/datasets.html#dataset-generators)-DGP with $500$ observations. Due to the linearity of the DGP, Lasso and Logit Regression are nearly optimal choices for the nuisance estimation.
8486

@@ -134,7 +136,7 @@ generate_and_show_styled_table(
134136
)
135137
```
136138

137-
## Causal Contrast Coverage
139+
### Causal Contrast Coverage
138140

139141
The simulations are based on the the [make_irm_data_discrete_treatments](https://docs.doubleml.org/stable/api/datasets.html#dataset-generators)-DGP with $500$ observations. Due to the linearity of the DGP, Lasso and Logit Regression are nearly optimal choices for the nuisance estimation.
140142

@@ -189,3 +191,118 @@ generate_and_show_styled_table(
189191
coverage_highlight_cols=["Coverage", "Uniform Coverage"]
190192
)
191193
```
194+
195+
196+
## Tuning
197+
198+
The simulations are based on the the [make_irm_data_discrete_treatments](https://docs.doubleml.org/stable/api/datasets.html#dataset-generators)-DGP with $500$ observations. This is only an example as the untuned version just relies on the default configuration.
199+
200+
### APOS Coverage
201+
202+
The non-uniform results (coverage, ci length and bias) refer to averaged values over all quantiles (point-wise confidende intervals).
203+
204+
::: {.callout-note title="Metadata" collapse="true"}
205+
206+
```{python}
207+
#| echo: false
208+
metadata_file = '../../results/irm/apos_tune_metadata.csv'
209+
metadata_df = pd.read_csv(metadata_file)
210+
print(metadata_df.T.to_string(header=False))
211+
```
212+
213+
:::
214+
215+
```{python}
216+
#| echo: false
217+
218+
# set up data
219+
df_apos = pd.read_csv("../../results/irm/apos_tune_coverage.csv", index_col=None)
220+
221+
assert df_apos["repetition"].nunique() == 1
222+
n_rep_apos = df_apos["repetition"].unique()[0]
223+
224+
display_columns_apos = ["Learner g", "Learner m", "Tuned", "Bias", "CI Length", "Coverage", "Uniform CI Length", "Uniform Coverage"]
225+
```
226+
227+
```{python}
228+
#| echo: false
229+
230+
generate_and_show_styled_table(
231+
main_df=df_apos,
232+
filters={"level": 0.95},
233+
display_cols=display_columns_apos,
234+
n_rep=n_rep_apos,
235+
level_col="level",
236+
coverage_highlight_cols=["Coverage", "Uniform Coverage"]
237+
)
238+
```
239+
240+
241+
```{python}
242+
#| echo: false
243+
244+
generate_and_show_styled_table(
245+
main_df=df_apos,
246+
filters={"level": 0.9},
247+
display_cols=display_columns_apos,
248+
n_rep=n_rep_apos,
249+
level_col="level",
250+
coverage_highlight_cols=["Coverage", "Uniform Coverage"]
251+
)
252+
```
253+
254+
255+
### Causal Contrast Coverage
256+
257+
The non-uniform results (coverage, ci length and bias) refer to averaged values over all quantiles (point-wise confidende intervals).
258+
259+
260+
::: {.callout-note title="Metadata" collapse="true"}
261+
262+
```{python}
263+
#| echo: false
264+
metadata_file = '../../results/irm/apos_tune_metadata.csv'
265+
metadata_df = pd.read_csv(metadata_file)
266+
print(metadata_df.T.to_string(header=False))
267+
```
268+
269+
:::
270+
271+
```{python}
272+
#| echo: false
273+
274+
# set up data
275+
df_contrast = pd.read_csv("../../results/irm/apos_tune_causal_contrast.csv", index_col=None)
276+
277+
assert df_contrast["repetition"].nunique() == 1
278+
n_rep_contrast = df_contrast["repetition"].unique()[0]
279+
280+
display_columns_contrast = ["Learner g", "Learner m", "Tuned", "Bias", "CI Length", "Coverage", "Uniform CI Length", "Uniform Coverage"]
281+
```
282+
283+
```{python}
284+
#| echo: false
285+
286+
generate_and_show_styled_table(
287+
main_df=df_contrast,
288+
filters={"level": 0.95},
289+
display_cols=display_columns_contrast,
290+
n_rep=n_rep_contrast,
291+
level_col="level",
292+
coverage_highlight_cols=["Coverage", "Uniform Coverage"]
293+
)
294+
```
295+
296+
297+
```{python}
298+
#| echo: false
299+
300+
generate_and_show_styled_table(
301+
main_df=df_contrast,
302+
filters={"level": 0.9},
303+
display_cols=display_columns_contrast,
304+
n_rep=n_rep_contrast,
305+
level_col="level",
306+
coverage_highlight_cols=["Coverage", "Uniform Coverage"]
307+
)
308+
```

doc/plm/lplr.qmd

Lines changed: 91 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,3 +111,94 @@ generate_and_show_styled_table(
111111
coverage_highlight_cols=["Coverage"]
112112
)
113113
```
114+
115+
116+
## Tuning
117+
118+
The simulations are based on the the [make_lplr_LZZ2020](https://docs.doubleml.org/stable/api/generated/doubleml.plm.datasets.make_lplr_LZZ2020.html)-DGP with $500$ observations. This is only an example as the untuned version just relies on the default configuration.
119+
120+
::: {.callout-note title="Metadata" collapse="true"}
121+
122+
```{python}
123+
#| echo: false
124+
metadata_file = '../../results/plm/lplr_ate_tune_metadata.csv'
125+
metadata_df = pd.read_csv(metadata_file)
126+
print(metadata_df.T.to_string(header=False))
127+
```
128+
129+
:::
130+
131+
```{python}
132+
#| echo: false
133+
134+
# set up data and rename columns
135+
df_coverage = pd.read_csv("../../results/plm/lplr_ate_tune_coverage.csv", index_col=None)
136+
137+
if "repetition" in df_coverage.columns and df_coverage["repetition"].nunique() == 1:
138+
n_rep_coverage = df_coverage["repetition"].unique()[0]
139+
elif "n_rep" in df_coverage.columns and df_coverage["n_rep"].nunique() == 1:
140+
n_rep_coverage = df_coverage["n_rep"].unique()[0]
141+
else:
142+
n_rep_coverage = "N/A" # Fallback if n_rep cannot be determined
143+
144+
display_columns_coverage = ["Learner m", "Learner M", "Learner t", "Tuned", "Bias", "CI Length", "Coverage"]
145+
```
146+
147+
### Nuisance space
148+
149+
```{python}
150+
# | echo: false
151+
152+
generate_and_show_styled_table(
153+
main_df=df_coverage,
154+
filters={"level": 0.95, "Score": "nuisance_space"},
155+
display_cols=display_columns_coverage,
156+
n_rep=n_rep_coverage,
157+
level_col="level",
158+
# rename_map={"Learner g": "Learner l"},
159+
coverage_highlight_cols=["Coverage"]
160+
)
161+
```
162+
163+
```{python}
164+
#| echo: false
165+
166+
generate_and_show_styled_table(
167+
main_df=df_coverage,
168+
filters={"level": 0.9, "Score": "nuisance_space"},
169+
display_cols=display_columns_coverage,
170+
n_rep=n_rep_coverage,
171+
level_col="level",
172+
# rename_map={"Learner g": "Learner l"},
173+
coverage_highlight_cols=["Coverage"]
174+
)
175+
```
176+
177+
### Instrument
178+
179+
180+
```{python}
181+
#| echo: false
182+
183+
generate_and_show_styled_table(
184+
main_df=df_coverage,
185+
filters={"level": 0.95, "Score": "instrument"},
186+
display_cols=display_columns_coverage,
187+
n_rep=n_rep_coverage,
188+
level_col="level",
189+
coverage_highlight_cols=["Coverage"]
190+
)
191+
```
192+
193+
```{python}
194+
#| echo: false
195+
196+
generate_and_show_styled_table(
197+
main_df=df_coverage,
198+
filters={"level": 0.9, "Score": "instrument"},
199+
display_cols=display_columns_coverage,
200+
n_rep=n_rep_coverage,
201+
level_col="level",
202+
coverage_highlight_cols=["Coverage"]
203+
)
204+
```

doc/plm/plr.qmd

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -213,6 +213,17 @@ generate_and_show_styled_table(
213213

214214
The simulations are based on the the [make_plr_CCDDHNR2018](https://docs.doubleml.org/stable/api/generated/doubleml.plm.datasets.make_plr_CCDDHNR2018.html)-DGP with $500$ observations. This is only an example as the untuned version just relies on the default configuration.
215215

216+
::: {.callout-note title="Metadata" collapse="true"}
217+
218+
```{python}
219+
#| echo: false
220+
metadata_file = '../../results/plm/plr_ate_tune_metadata.csv'
221+
metadata_df = pd.read_csv(metadata_file)
222+
print(metadata_df.T.to_string(header=False))
223+
```
224+
225+
:::
226+
216227
```{python}
217228
#| echo: false
218229

0 commit comments

Comments
 (0)