-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathreport.html
More file actions
579 lines (515 loc) · 19.2 KB
/
report.html
File metadata and controls
579 lines (515 loc) · 19.2 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>{{ experiment_name }} – Experiment Report</title>
<style>
body {
font-family: system-ui, sans-serif;
margin: 2em;
line-height: 1.6;
}
h1, h2, h3 {
color: #2c3e50;
}
.group-section {
margin-bottom: 3em;
border: 1px solid #ccc;
padding: 1em;
border-radius: 6px;
}
.group-header {
display: flex;
justify-content: space-between;
align-items: center;
cursor: pointer;
}
.group-header h2 {
margin: 0;
}
.config-section {
margin-top: 1em;
}
.plot-row {
display: flex;
overflow-x: auto;
gap: 1em;
padding-bottom: 1em;
align-items: flex-start;
}
.plot-row > div,
.plot-row details.interactive-toggle {
display: flex;
flex-direction: column;
align-items: center;
/* force every tile to exactly 300px wide */
flex: 0 0 auto;
max-width: none;
}
.plot-row img,
.plot-row iframe {
border: 1px solid #aaa;
border-radius: 4px;
box-shadow: 0 0 4px rgba(0,0,0,0.1);
}
.plot-row img:not(.kde-plot) {
max-height: 200px;
}
img.kde-plot,
img.init-plot {
max-height: 180px;
max-width: 300px;
object-fit: contain;
}
.plot-title {
font-weight: bold;
text-align: center;
}
.plot-thumb {
width: 1100px;
height: 619px;
border: 1px solid #aaa;
border-radius: 4px;
box-shadow: 0 0 4px rgba(0,0,0,0.1);
max-height: none;
}
.plot-row details.interactive-toggle {
display: flex;
flex-direction: column;
align-items: center;
margin: 0;
padding: 0;
}
.plot-row details.interactive-toggle:not([open])
summary .summary-text {
display: none;
}
.plot-column-layout {
display: flex;
flex-direction: row;
gap: 1em;
overflow-x: auto;
padding-bottom: 1em;
align-items: flex-start;
}
.plot-column {
display: flex;
flex-direction: column;
align-items: center;
gap: 0.5em;
}
.plot-column span {
font-size: 0.9em;
color: #555;
}
.hidden {
display: none;
}
</style>
<script>
function toggleGroup(id) {
const content = document.getElementById(id);
const arrow = document.getElementById(id + '-arrow');
if (content.classList.contains('hidden')) {
content.classList.remove('hidden');
arrow.textContent = '▼';
} else {
content.classList.add('hidden');
arrow.textContent = '▶';
}
}
</script>
</head>
<body>
<h1>{{ experiment_name }} – Complete Experiment Report</h1>
{% set metrics = metrics or
["mean_rmse", "var_rmse" ,"wasserstein_distance", "mmd", "mmd_rff", "runtime", "ess", "ess_per_sec", "r_hat", "mode_transitions"] %}
{# --- Sampler vs IID (global, per sampler) --- #}
{% macro render_sampler_iid_table(sampler_stats, metric_key) %}
<table border="1" style="margin:0.75em 0; border-collapse:collapse;">
<thead>
<tr>
<th style="padding:4px 8px;">Sampler</th>
<th style="padding:4px 8px;">Varying</th>
<th style="padding:4px 8px;">t-stat</th>
<th style="padding:4px 8px;">p-value</th>
<th style="padding:4px 8px;">Glass Δ</th>
</tr>
</thead>
<tbody>
{% for sampler, per_metric in sampler_stats.items() if metric_key in per_metric %}
{% set s = per_metric[metric_key] %}
{% for i in range(s["varying_value"]|length) %}
{% set p = s["p_value"][i] %}
{% set bg_color = "#b6fcb6" %}
{% if p < 0.0125 %}
{% set bg_color = "#fcb6b6" %}
{% elif p < 0.025 %}
{% set bg_color = "#fff3b0" %}
{% endif %}
<tr>
<td style="padding:4px 8px;">{{ sampler }}</td>
<td style="padding:4px 8px;">{{ s["varying_value"][i] }}</td>
<td style="padding:4px 8px;">{{ "%.3f"|format(s["t_stat"][i]) }}</td>
<td style="padding:4px 8px; background-color: {{ bg_color }};">{{ "%.3g"|format(p) }}</td>
<td style="padding:4px 8px;">{{ "%.3f"|format(s["glass_delta"][i]) }}</td>
</tr>
{% endfor %}
{% endfor %}
</tbody>
</table>
{% endmacro %}
{# --- Sampler vs Sampler (pairwise) --- #}
{% macro render_sampler_pairwise_table(pairwise_stats, metric_base_key) %}
{% if metric_base_key not in pairwise_stats %}
<p style="color:#888; margin:0.5em 0;">No pairwise stats for {{ metric_base_key }}</p>
{% else %}
<table border="1" style="margin:0.75em 0; border-collapse:collapse;">
<thead>
<tr>
<th style="padding:4px 8px;">Sampler Pair</th>
<th style="padding:4px 8px;">Varying</th>
<th style="padding:4px 8px;">t-stat</th>
<th style="padding:4px 8px;">p-value</th>
<th style="padding:4px 8px;">Cohen’s d</th>
</tr>
</thead>
<tbody>
{% for pair, cols in pairwise_stats[metric_base_key].items() %}
{% set n = (cols.get(metric_base_key ~ "_t_stat") or []) | length %}
{% for i in range(n) %}
{# Compute background color for p-value #}
{% set p = (cols.get(metric_base_key ~ "_p_value"))[i] %}
{% set bg_color = "#b6fcb6" %}
{% if p < 0.0083 %}
{% set bg_color = "#fcb6b6" %}
{% elif p < 0.0167 %}
{% set bg_color = "#fff3b0" %}
{% endif %}
<tr>
<td style="padding:4px 8px;">{{ pair }}</td>
<td style="padding:4px 8px;">
{# Try common varying columns; fall back gracefully #}
{% if "correlation" in cols %}
{{ cols["correlation"][i] }}
{% elif "varying_value" in cols %}
{{ cols["varying_value"][i] }}
{% else %}
{{ i }}
{% endif %}
</td>
<td style="padding:4px 8px;">
{{ "%.3f"|format(
(cols.get(metric_base_key ~ "_t_stat"))[i]
)
}}
</td>
<td style="padding:4px 8px; background-color: {{ bg_color }};">
{{ "%.3g"|format(p) }}
</td>
<td style="padding:4px 8px;">
{{ "%.3f"|format(
(cols.get(metric_base_key ~ "_paired_cohens_d") or cols.get("ws_paired_cohens_d", [None]*n))[i]
) if (cols.get(metric_base_key ~ "_paired_cohens_d") or cols.get("ws_paired_cohens_d")) else "–" }}
</td>
</tr>
{% endfor %}
{% endfor %}
</tbody>
</table>
{% endif %}
{% endmacro %}
{% macro render_glass_delta_table(delta_data, metric_base_key) %}
<table border="1" style="margin:0.75em 0; border-collapse:collapse;">
<thead>
<tr>
<th style="padding:4px 8px;">Sampler</th>
<th style="padding:4px 8px;">Varying</th>
<th style="padding:4px 8px;">MCMC Mean</th>
<th style="padding:4px 8px;">IID Mean</th>
<th style="padding:4px 8px;">IID Std</th>
<th style="padding:4px 8px;">Glass’s Δ</th>
</tr>
</thead>
<tbody>
{% for sampler, sampler_data in delta_data.items() %}
{% if metric_base_key in sampler_data %}
{% set stats = sampler_data[metric_base_key] %}
{% set n = stats["mcmc_mean"] | length %}
{% for i in range(n) %}
<tr>
<td style="padding:4px 8px;">{{ sampler }}</td>
<td style="padding:4px 8px;">{{ sampler_data.varying_value[i] }}</td>
<td style="padding:4px 8px;">{{ "%.3f"|format(stats.mcmc_mean[i]) }}</td>
<td style="padding:4px 8px;">{{ "%.3f"|format(stats.iid_mean[i]) }}</td>
<td style="padding:4px 8px;">{{ "%.3f"|format(stats.iid_std[i]) }}</td>
<td style="padding:4px 8px;">{{ "%.3f"|format(stats.glass_delta[i]) if stats.glass_delta is defined else "%.3f"|format((stats.mcmc_mean[i] - stats.iid_mean[i]) / stats.iid_std[i]) }}</td>
</tr>
{% endfor %}
{% endif %}
{% endfor %}
</tbody>
</table>
{% endmacro %}
<!-- Repeat this block per group -->
{% for group in groups %}
<div class="group-section">
<div class="group-header" onclick="toggleGroup('group-{{ loop.index }}')">
<h2>{{ group.name }}</h2>
<span id="group-{{ loop.index }}-arrow">▼</span>
</div>
<div id="group-{{ loop.index }}">
{% for config in group.configs %}
<div class="config-section">
<h3>
{{ config.config_descr }}
({{ config.posterior_type }},
{{ config.varying_attribute }},
{{ config.runs }} runs)
</h3>
{# ---------- helper macro ---------- #}
{% macro metric_grid(metric_paths, glass_paths, scatter_paths, scatter_html_paths, title, open, sampler_stats, pairwise_stats, delta_data) -%}
{% set metric_key_map = {
'wasserstein_distance': 'ws',
'mean_rmse': 'mean_rmse',
'var_rmse': 'var_rmse',
'mmd': 'mmd',
'mmd_rff': 'mmd_rff'
} %}
<details {% if open %}open{% endif %}>
<summary><b>{{ title }}</b></summary>
<div class="plot-row">
{% for m in metrics %}
{% if metric_paths[m] is defined %}
<div>
<div class="plot-title">{{ m.replace('_',' ').title() }}</div>
<img src="{{ metric_paths[m] }}" alt="{{ m }} plot">
{% set metric_key = metric_key_map.get(m) %}
{% if metric_key %}
<details>
<summary><b>Sampler vs IID stats</b></summary>
{{ render_sampler_iid_table(sampler_stats, metric_key) }}
</details>
<details>
<summary><b>Sampler vs Sampler stats</b></summary>
{{ render_sampler_pairwise_table(pairwise_stats, metric_key.replace('_dist', '')) }}
</details>
{% endif %}
</div>
{% endif %}
{# scatter thumbnails where available #}
{% if scatter_paths[m] is defined %}
<div>
<div class="plot-title">{{ m.replace('_',' ').title() }} (interactive)</div>
<img src="{{ scatter_paths[m] }}" alt="{{ m }} scatter plot">
</div>
{% endif %}
{# interactive scatter iframe, now collapsible #}
{% if scatter_html_paths[m] is defined %}
<details class="interactive-toggle">
<summary>
<span class="plot-title summary-text">
{{ m.replace('_',' ').title() }} (scatter)
</span>
</summary>
<iframe src="{{ scatter_html_paths[m] }}"
class="plot-thumb"
loading="lazy">
</iframe>
</details>
{% endif %}
{# extra Glass-Δ thumbnails where available #}
{% if m == 'mean_rmse' and glass_paths.mean_rmse is defined %}
<div>
<div class="plot-title">Glass’s Δ Mean RMSE</div>
<img src="{{ glass_paths.mean_rmse }}" alt="Glass Δ Mean RMSE">
<details>
<summary><b>Glass’s Δ table</b></summary>
{{ render_glass_delta_table(delta_data, 'mean_rmse') }}
</details>
</div>
{% elif m == 'var_rmse' and glass_paths.var_rmse is defined %}
<div>
<div class="plot-title">Glass’s Δ Variance RMSE</div>
<img src="{{ glass_paths.var_rmse }}" alt="Glass Δ Variance RMSE">
<details>
<summary><b>Glass’s Δ table</b></summary>
{{ render_glass_delta_table(delta_data, 'var_rmse') }}
</details>
</div>
{% elif m == 'wasserstein_distance' and glass_paths.ws is defined %}
<div>
<div class="plot-title">Glass’s Δ WS</div>
<img src="{{ glass_paths.ws }}" alt="Glass Δ WS">
<details>
<summary><b>Glass’s Δ table</b></summary>
{{ render_glass_delta_table(delta_data, 'ws') }}
</details>
</div>
{% elif m == 'mmd' and glass_paths.mmd is defined %}
<div>
<div class="plot-title">Glass’s Δ MMD</div>
<img src="{{ glass_paths.mmd }}" alt="Glass Δ MMD">
<details>
<summary><b>Glass’s Δ table</b></summary>
{{ render_glass_delta_table(delta_data, 'mmd') }}
</details>
</div>
{% elif m == 'mmd_rff' and glass_paths.mmd_rff is defined %}
<div>
<div class="plot-title">Glass’s Δ MMD-RFF</div>
<img src="{{ glass_paths.mmd_rff }}" alt="Glass Δ MMD-RFF">
<details>
<summary><b>Glass’s Δ table</b></summary>
{{ render_glass_delta_table(delta_data, 'mmd_rff') }}
</details>
</div>
{% endif %}
{% endfor %}
</div>
</details>
{%- endmacro %}
{# ---------- pooled level plots ---------- #}
{{ metric_grid(
config.metric_plot_paths_pooled,
config.glass_plot_paths_pooled,
config.scatter_plot_paths_pooled,
config.scatter_html_paths_pooled,
"Pooled Chains results",
true,
config.sampler_stats_pooled,
config.pairwise_stats_pooled,
config.delta_data_pooled
) }}
{# ---------- chain level plots ---------- #}
{% if config.metric_plot_paths_chain %}
{{ metric_grid(
config.metric_plot_paths_chain,
config.glass_plot_paths_chain,
config.scatter_plot_paths_chain,
config.scatter_html_paths_chain,
"One Chain results",
false,
config.sampler_stats_chain,
config.pairwise_stats_chain,
config.delta_data_chain
) }}
{% endif %}
{# ---------- KDE + init ---------- #}
{% if config.kde_init_triples %}
<details>
<summary><b>KDE + Init Plots</b></summary>
<div class="plot-column-layout">
{% for kde, pooled, chain in config.kde_init_triples %}
<div class="plot-column">
<img src="{{ kde}}" alt="KDE plot" class="kde-plot">
<img src="{{ pooled }}" alt="Pooled Init Plot" class="init-plot">
<img src="{{ chain }}" alt="Chain Init Plot" class="init-plot">
</div>
{% endfor %}
</div>
</details>
{% endif %}
{# ---------- Trace Plots ---------- #}
{% if config.trace_groups %}
<details>
<summary><b>Forest & Ridge Plots</b></summary>
{# „Pooled“-Block #}
<details open>
<summary style="font-weight:bold; cursor:pointer;">Pooled</summary>
<div class="plot-column-layout">
{% for grp in config.trace_groups %}
<div class="plot-column">
<span class="plot-title">{{ grp.varying_value }}</span>
{% for s in grp.samplers %}
{% if s.pooled_trace %}
<img src="{{ s.pooled_trace }}"
alt="{{ s.sampler }} pooled trace"
class="init-plot">
{% endif %}
{% endfor %}
</div>
{% endfor %}
</div>
</details>
{# „Chain“-Block #}
<details>
<summary style="font-weight:bold; cursor:pointer;">Chain</summary>
<div class="plot-column-layout">
{% for grp in config.trace_groups %}
<div class="plot-column">
<span class="plot-title">{{ grp.varying_value }}</span>
{% for s in grp.samplers %}
{% if s.chain_trace %}
<img src="{{ s.chain_trace }}"
alt="{{ s.sampler }} chain trace"
class="init-plot">
{% endif %}
{% endfor %}
</div>
{% endfor %}
</div>
</details>
</details>
{% endif %}
{# ---------- Interactive Pairwise Scatter Plots ---------- #}
{% if config.scatter_groups %}
<details>
<summary><b>Pairwise Scatter Plots</b></summary>
{# Pooled subsection #}
<details open>
<summary style="font-weight:bold; cursor:pointer;">Pooled</summary>
<div class="plot-column-layout">
{% for grp in config.scatter_groups %}
<div class="plot-column">
<span class="plot-title">{{ grp.varying_value }}</span>
{% for s in grp.samplers %}
{% if s.pooled_pairwise_scatter %}
<iframe
src="{{ s.pooled_pairwise_scatter }}"
class="interactive-iframe"
frameborder="0"
scrolling="no"
width="100%"
height="300px"
loading="lazy">
</iframe>
{% endif %}
{% endfor %}
</div>
{% endfor %}
</div>
</details>
{# Chain subsection #}
<details>
<summary style="font-weight:bold; cursor:pointer;">Chain</summary>
<div class="plot-column-layout">
{% for grp in config.scatter_groups %}
<div class="plot-column">
<span class="plot-title">{{ grp.varying_value }}</span>
{% for s in grp.samplers %}
{% if s.chain_pairwise_scatter %}
<iframe
src="{{ s.chain_pairwise_scatter }}"
class="interactive-iframe"
frameborder="0"
scrolling="no"
width="100%"
height="300px"
loading="lazy">
</iframe>
{% endif %}
{% endfor %}
</div>
{% endfor %}
</div>
</details>
</details>
{% endif %}
</div>
{% endfor %}
</div>
</div>
{% endfor %}
</body>
</html>