Skip to content

Commit 8604790

Browse files
authored
docs: fix tutorial typos (#1341)
* fix typos without adding output changes.
1 parent e7940dc commit 8604790

File tree

4 files changed

+19
-12
lines changed

4 files changed

+19
-12
lines changed

tutorials/03_density_estimators.ipynb

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
"cell_type": "markdown",
2626
"metadata": {},
2727
"source": [
28-
"One option is to use one of set of preconfigured density estimators by passing a string in the `density_estimator` keyword argument to the inference object (`NPE` or `NLE`), e.g., \"maf\" to use a Masked Autoregressive Flow, of \"nsf\" to use a Neural Spline Flow with default hyperparameters.\n"
28+
"One option is using one of the preconfigured density estimators by passing a string in the `density_estimator` keyword argument to the inference object (`NPE` or `NLE`), e.g., \"maf\" for a Masked Autoregressive Flow, of \"nsf\" for a Neural Spline Flow with default hyperparameters.\n"
2929
]
3030
},
3131
{
@@ -101,9 +101,9 @@
101101
"cell_type": "markdown",
102102
"metadata": {},
103103
"source": [
104-
"It is also possible to pass an `embedding_net` to `posterior_nn()` which learn summary\n",
105-
"statistics from high-dimensional simulation outputs. You can find a more detailed\n",
106-
"tutorial on this in [04_embedding_networks](04_embedding_networks.md).\n"
104+
"It is also possible to pass an `embedding_net` to `posterior_nn()` to automatically\n",
105+
"learn summary statistics from high-dimensional simulation outputs. You can find a more\n",
106+
"detailed tutorial on this in [04_embedding_networks](04_embedding_networks.md).\n"
107107
]
108108
},
109109
{

tutorials/08_crafting_summary_statistics.ipynb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
"metadata": {},
1313
"source": [
1414
"Many simulators produce outputs that are high-dimesional. For example, a simulator might\n",
15-
"generate a time series or an image. In the tutorial on [04_embedding_networks](04_embedding_networks.md), we discussed how a\n",
15+
"generate a time series or an image. In the tutorial [04_embedding_networks](04_embedding_networks.md), we discussed how a\n",
1616
"neural networks can be used to learn summary statistics from such data. In this\n",
1717
"notebook, we will instead focus on hand-crafting summary statistics. We demonstrate that\n",
1818
"the choice of summary statistics can be crucial for the performance of the inference\n",

tutorials/12_iid_data_and_permutation_invariant_embeddings.ipynb

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -325,7 +325,9 @@
325325
"source": [
326326
"## IID inference with NPE using permutation-invariant embedding nets\n",
327327
"\n",
328-
"For NPE we need to define an embedding net that handles the set-like structure of iid-data, i.e., that it permutation invariant and can handle different number of trials.\n",
328+
"For NPE we need to define an embedding net that handles the set-like structure of\n",
329+
"iid-data, i.e., a permutation invariant networks that can handle different numbers and\n",
330+
"orderings of trials.\n",
329331
"\n",
330332
"We implemented several embedding net classes that allow to construct such a permutation- and number-of-trials invariant embedding net.\n",
331333
"\n",

tutorials/15_importance_sampled_posteriors.ipynb

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -58,11 +58,9 @@
5858
"from torch import ones, eye\n",
5959
"import torch\n",
6060
"from torch.distributions import MultivariateNormal\n",
61-
"import matplotlib.pyplot as plt\n",
6261
"\n",
6362
"from sbi.inference import NPE, ImportanceSamplingPosterior\n",
6463
"from sbi.utils import BoxUniform\n",
65-
"from sbi.inference.potentials.base_potential import BasePotential\n",
6664
"from sbi.analysis import marginal_plot"
6765
]
6866
},
@@ -71,7 +69,7 @@
7169
"id": "4808d6d3-cb14-4ecd-a0f5-824bf54a5b01",
7270
"metadata": {},
7371
"source": [
74-
"We first define a simulator and a prior which both have functions for sampling (as required for SBI) and log_prob evaluations (as required for importance sampling)."
72+
"We first define a simulator and a prior which both have a `sample` function (as required for `sbi`) and `log_prob` evaluations (as required for importance sampling)."
7573
]
7674
},
7775
{
@@ -202,9 +200,16 @@
202200
"id": "7150cc13-9911-4656-936f-9cafb867eba4",
203201
"metadata": {},
204202
"source": [
205-
"With the SBI toolbox, importance sampling is a one-liner. SBI supports two methods for importance sampling:\n",
206-
"- `\"importance\"`: returns `n_samples` weighted samples (as above) corresponding to `n_samples * sample_efficiency` samples from the posterior. This results in unbiased samples, but the number of effective samples may be small when the SBI estimate is inaccurate.\n",
207-
"- `\"sir\"` (sampling-importance-resampling): performs rejection sampling on a batched basis with batch size `oversampling_factor`. This is a guaranteed way to obtain `N / oversampling_factor` samples, but these may be biased as the weight normalization is not performed across the entire set of samples."
203+
"With the `sbi` toolbox, importance sampling is a one-liner. `sbi` supports two methods\n",
204+
"for importance sampling:\n",
205+
"- `\"importance\"`: returns `n_samples` weighted samples (as above) corresponding to\n",
206+
" `n_samples * sample_efficiency` samples from the posterior. This results in unbiased\n",
207+
" samples, but the number of effective samples may be small when the `sbi` estimate is\n",
208+
" inaccurate.\n",
209+
"- `\"sir\"` (sampling-importance-resampling): performs rejection sampling on a batched\n",
210+
" basis with batch size `oversampling_factor`. This is a guaranteed way to obtain `N /\n",
211+
" oversampling_factor` samples, but these may be biased as the weight normalization is\n",
212+
" not performed across the entire set of samples."
208213
]
209214
},
210215
{

0 commit comments

Comments
 (0)