Skip to content

Commit cd09d1e

Browse files
Fixups for new RTD website (#1573)
* Fixups for new RTD website * update docstrings
1 parent 4c173ab commit cd09d1e

35 files changed

+427
-333
lines changed
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{{ fullname }}
2+
{{ underline }}
3+
4+
.. autoclass:: {{ fullname }}
5+
:members:
6+
:undoc-members:
7+
:inherited-members:
8+
:show-inheritance:

docs/conf.py

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@
1616
# import os
1717
# import sys
1818
# sys.path.insert(0, os.path.abspath('.'))
19+
import os
20+
import shutil
1921

2022
# -- Project information -----------------------------------------------------
2123

@@ -98,3 +100,23 @@
98100
autodoc_typehints = "description"
99101
add_module_names = False
100102
autodoc_member_order = "bysource"
103+
104+
105+
def copy_data_folder(app, exception):
106+
"""Copy all images in `how_to_guide/data` to the `_build_` folder.
107+
108+
This function was written by ChatGPT."""
109+
if exception is None:
110+
source_dir = os.path.join(app.srcdir, 'how_to_guide', 'data')
111+
dest_dir = os.path.join(app.outdir, 'how_to_guide', 'data')
112+
if os.path.exists(source_dir):
113+
os.makedirs(dest_dir, exist_ok=True)
114+
for filename in os.listdir(source_dir):
115+
shutil.copyfile(
116+
os.path.join(source_dir, filename), os.path.join(dest_dir, filename)
117+
)
118+
119+
120+
def setup(app):
121+
"""Action to copy all images in `how_to_guide/data` to the `_build_` folder."""
122+
app.connect('build-finished', copy_data_folder)

docs/how_to_guide/13_diagnostics_lc2st.ipynb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@
7171
"cell_type": "markdown",
7272
"metadata": {},
7373
"source": [
74-
"<img src=\"l_c2st_pp_plot.png\" width=\"500\">"
74+
"<img src=\"data/l_c2st_pp_plot.png\" width=\"500\">"
7575
]
7676
},
7777
{

docs/how_to_guide/15_expected_coverage.ipynb

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,15 @@
22
"cells": [
33
{
44
"cell_type": "markdown",
5-
"id": "262a8be1",
5+
"id": "7de8bf27",
66
"metadata": {},
77
"source": [
88
"# How to run expected coverage"
99
]
1010
},
1111
{
1212
"cell_type": "markdown",
13-
"id": "afdf4c0c",
13+
"id": "e431d6e1",
1414
"metadata": {},
1515
"source": [
1616
"Expected coverage provides a simple and interpretable tool to diagnose issues in the posterior. In comparison to other diagnostic tools such as L-C2ST, it requires relatively few additional simulations (~200) and it does not rely on any additional hyperparameters (as TARP would) or additional neural network training.\n",
@@ -22,15 +22,15 @@
2222
},
2323
{
2424
"cell_type": "markdown",
25-
"id": "f897470f",
25+
"id": "81d072a6",
2626
"metadata": {},
2727
"source": [
2828
"## Main syntax"
2929
]
3030
},
3131
{
3232
"cell_type": "markdown",
33-
"id": "4b758674",
33+
"id": "a1e890c2",
3434
"metadata": {},
3535
"source": [
3636
"```python\n",
@@ -66,23 +66,23 @@
6666
},
6767
{
6868
"cell_type": "markdown",
69-
"id": "3a700ac9",
69+
"id": "dd374b82",
7070
"metadata": {},
7171
"source": [
7272
"This will return a figure such as the following:"
7373
]
7474
},
7575
{
7676
"cell_type": "markdown",
77-
"id": "1614d726",
77+
"id": "5db59c6e",
7878
"metadata": {},
7979
"source": [
80-
"<img src=\"sbc_rank_plot.png\" width=\"500\">"
80+
"<img src=\"data/sbc_rank_plot.png\" width=\"500\">"
8181
]
8282
},
8383
{
8484
"cell_type": "markdown",
85-
"id": "14c277ea",
85+
"id": "1072f685",
8686
"metadata": {},
8787
"source": [
8888
"You can interpret this plots as follows:\n",

docs/how_to_guide/16_sbc.ipynb

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,15 @@
22
"cells": [
33
{
44
"cell_type": "markdown",
5-
"id": "85533aa3",
5+
"id": "7741d8ac",
66
"metadata": {},
77
"source": [
88
"# How to run simulation-based calibration (SBC)"
99
]
1010
},
1111
{
1212
"cell_type": "markdown",
13-
"id": "eee436d4",
13+
"id": "aceee7d6",
1414
"metadata": {},
1515
"source": [
1616
"Similar to expected coverage, simulation-based calibration (SBC) provides a simple and interpretable tool to diagnose issues in the posterior. It also requires relatively few additional simulations (~200) and it does not rely on any additional hyperparameters (as TARP would) or additional neural network training.\n",
@@ -22,15 +22,15 @@
2222
},
2323
{
2424
"cell_type": "markdown",
25-
"id": "5586331e",
25+
"id": "48d5f324",
2626
"metadata": {},
2727
"source": [
2828
"## Main syntax"
2929
]
3030
},
3131
{
3232
"cell_type": "markdown",
33-
"id": "2a4f6e84",
33+
"id": "41f152b0",
3434
"metadata": {},
3535
"source": [
3636
"```python\n",
@@ -63,31 +63,31 @@
6363
},
6464
{
6565
"cell_type": "markdown",
66-
"id": "fbfbb941",
66+
"id": "0d2ec9af",
6767
"metadata": {},
6868
"source": [
6969
"The only difference to running expected coverage is that we did not pass `run_sbc(..., reduce_fns=...)` and we visualize it differently by not passing `sbc_rank_plot(..., plot_type=\"cdf\")`"
7070
]
7171
},
7272
{
7373
"cell_type": "markdown",
74-
"id": "2f5d7d31",
74+
"id": "2cdd5ca1",
7575
"metadata": {},
7676
"source": [
7777
"This will return a figure such as the following:"
7878
]
7979
},
8080
{
8181
"cell_type": "markdown",
82-
"id": "25fed9c0",
82+
"id": "cb91ea03",
8383
"metadata": {},
8484
"source": [
85-
"<img src=\"sbc_plot.png\" width=\"500\">"
85+
"<img src=\"data/sbc_plot.png\" width=\"500\">"
8686
]
8787
},
8888
{
8989
"cell_type": "markdown",
90-
"id": "b8d2f1e9",
90+
"id": "3467dcb5",
9191
"metadata": {},
9292
"source": [
9393
"This plots as many plots as there are parameters. For each of the parameters you can interpret the the shape of the red bars as follows:\n",
@@ -100,15 +100,15 @@
100100
},
101101
{
102102
"cell_type": "markdown",
103-
"id": "4fdb5991",
103+
"id": "e758d940",
104104
"metadata": {},
105105
"source": [
106106
"## Example"
107107
]
108108
},
109109
{
110110
"cell_type": "markdown",
111-
"id": "d49e4382",
111+
"id": "67c19086",
112112
"metadata": {},
113113
"source": [
114114
"For a detailed example and further explanation, see [this tutorial](https://sbi.readthedocs.io/en/latest/advanced_tutorials/11_diagnostics_simulation_based_calibration.html)."

docs/how_to_guide/17_tarp.ipynb

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,15 @@
22
"cells": [
33
{
44
"cell_type": "markdown",
5-
"id": "2239191b",
5+
"id": "8cd307dd",
66
"metadata": {},
77
"source": [
88
"# How to run TARP"
99
]
1010
},
1111
{
1212
"cell_type": "markdown",
13-
"id": "40eb9908",
13+
"id": "59d719f3",
1414
"metadata": {},
1515
"source": [
1616
"TARP is an alternative calibration check proposed recently in https://arxiv.org/abs/2302.03026. \n",
@@ -30,7 +30,7 @@
3030
},
3131
{
3232
"cell_type": "markdown",
33-
"id": "80dc7728",
33+
"id": "5db62ea3",
3434
"metadata": {},
3535
"source": [
3636
"```python\n",
@@ -62,39 +62,39 @@
6262
},
6363
{
6464
"cell_type": "markdown",
65-
"id": "2d8ada2f",
65+
"id": "c73833f8",
6666
"metadata": {},
6767
"source": [
6868
"This generates a plot like the following:"
6969
]
7070
},
7171
{
7272
"cell_type": "markdown",
73-
"id": "9f5fbbee",
73+
"id": "a3589a9f",
7474
"metadata": {},
7575
"source": [
76-
"<img src=\"tarp_plot.png\" width=\"400\">"
76+
"<img src=\"data/tarp_plot.png\" width=\"400\">"
7777
]
7878
},
7979
{
8080
"cell_type": "markdown",
81-
"id": "d90cc58f",
81+
"id": "ee39a40d",
8282
"metadata": {},
8383
"source": [
8484
"If the blue curve is above the diagonal, then the posterior estimate is under-confident. If it is under the diagonal, then the posterior estimate is over confident."
8585
]
8686
},
8787
{
8888
"cell_type": "markdown",
89-
"id": "7f10f082",
89+
"id": "2bf07d41",
9090
"metadata": {},
9191
"source": [
9292
"## Explanation"
9393
]
9494
},
9595
{
9696
"cell_type": "markdown",
97-
"id": "37c99744",
97+
"id": "45c402a1",
9898
"metadata": {},
9999
"source": [
100100
"Given a test set $(\\theta^*, x^*)$ and a set of reference points $\\theta_r$, TARP calculates \n",

0 commit comments

Comments
 (0)