Skip to content

Commit d461d60

Browse files
committed
[no ci] user guide: add stub on summary/inference networks
1 parent 728b130 commit d461d60

File tree

3 files changed

+84
-0
lines changed

3 files changed

+84
-0
lines changed

docsrc/source/user_guide/index.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,4 +12,6 @@ If you want to contribute, feel free to open an issue or a pull request, we welc
1212
introduction
1313
generative_models.ipynb
1414
data_processing.ipynb
15+
summary_networks.ipynb
16+
inference_networks.ipynb
1517
```
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
{
2+
"cells": [
3+
{
4+
"cell_type": "markdown",
5+
"id": "83d9cd3f-85cd-4faf-9ea8-5d1473b67fd9",
6+
"metadata": {},
7+
"source": [
8+
"# Inference Networks\n",
9+
"\n",
10+
"Inference networks form the backbone of neural amortized Bayesian inference methods. They are generative models (usually _invertible_ ones, but they do not have to be), that can transform samples from a simple distribution (e.g., a unit Gaussian) to a complicated one (e.g., a posterior distribution).\n",
11+
"\n",
12+
"You can find the inference networks in the {py:mod}`~bayesflow.networks` module. You can identify them by the \"Bases: {py:class}`~bayesflow.networks.InferenceNetwork`\" label.\n",
13+
"\n",
14+
"## CouplingFlow\n",
15+
"\n",
16+
"The {py:class}`~bayesflow.networks.CouplingFlow` is the traditional inference network in SBI. It features fast inference, but can lack expressivity, especially when the density changes quickly (e.g., at the bounds of a uniform distribution). For training, it uses a negative log-likelihood loss, so the loss is indicative of the performance (lower is better, but zero has no special meaning).\n",
17+
"\n",
18+
"## FlowMatching\n",
19+
"\n",
20+
"{py:class}`~bayesflow.networks.FlowMatching` is a continuous flow, and one of the most expressive architectures currently available. We recommend it for more complex models and posteriors. The expressivity comes at the cost of inference speed, as inference requires solving an ordinary differential equation (ODE), which requires many network passes. In addition, after an initial drop, the loss is not indicative of the performance anymore, so one has to rely on different means to evaluate performance during training (or just hope for the best and evaluate after training)."
21+
]
22+
}
23+
],
24+
"metadata": {
25+
"kernelspec": {
26+
"display_name": "Python 3 (ipykernel)",
27+
"language": "python",
28+
"name": "python3"
29+
},
30+
"language_info": {
31+
"codemirror_mode": {
32+
"name": "ipython",
33+
"version": 3
34+
},
35+
"file_extension": ".py",
36+
"mimetype": "text/x-python",
37+
"name": "python",
38+
"nbconvert_exporter": "python",
39+
"pygments_lexer": "ipython3",
40+
"version": "3.11.11"
41+
}
42+
},
43+
"nbformat": 4,
44+
"nbformat_minor": 5
45+
}
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
{
2+
"cells": [
3+
{
4+
"cell_type": "markdown",
5+
"id": "83d9cd3f-85cd-4faf-9ea8-5d1473b67fd9",
6+
"metadata": {},
7+
"source": [
8+
"# Summary Networks\n",
9+
"\n",
10+
"Learnable summary statistics provide several advantages for amortized Bayesian inference. By reducing the dimensionality of the data, they enable more efficient processing by the inference network. Additionally, they can encode knowledge about the data (e.g., that different observations are exchangeable) directly into the network architecture. Finally, the resulting _summary space_ can serve as a diagnostic tool. In some cases, we also require a summary network to convert observations of variable size into a fixed-size representation.\n",
11+
"\n",
12+
"You can find the summary networks in the {py:mod}`~bayesflow.networks` module. You can identify them by the \"Bases: {py:class}`~bayesflow.networks.SummaryNetwork`\" label."
13+
]
14+
}
15+
],
16+
"metadata": {
17+
"kernelspec": {
18+
"display_name": "Python 3 (ipykernel)",
19+
"language": "python",
20+
"name": "python3"
21+
},
22+
"language_info": {
23+
"codemirror_mode": {
24+
"name": "ipython",
25+
"version": 3
26+
},
27+
"file_extension": ".py",
28+
"mimetype": "text/x-python",
29+
"name": "python",
30+
"nbconvert_exporter": "python",
31+
"pygments_lexer": "ipython3",
32+
"version": "3.11.11"
33+
}
34+
},
35+
"nbformat": 4,
36+
"nbformat_minor": 5
37+
}

0 commit comments

Comments
 (0)