Skip to content

Commit 95182fc

Browse files
author
github-actions
committed
auto: Rebuild docs.
1 parent f401bad commit 95182fc

File tree

747 files changed

+48560
-26141
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

747 files changed

+48560
-26141
lines changed
77.6 KB
Binary file not shown.
52.6 KB
Binary file not shown.
Binary file not shown.

jupyter_execute/_examples/Covid19_Initial_Posterior_Estimation.ipynb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
},
1111
{
1212
"cell_type": "markdown",
13-
"id": "f436067e",
13+
"id": "506bae01",
1414
"metadata": {},
1515
"source": [
1616
"## Table of Contents\n",

jupyter_execute/_examples/From_ABC_to_BayesFlow.ipynb

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,10 @@
3838
"outputs": [],
3939
"source": [
4040
"import numpy as np\n",
41-
"import matplotlib.pyplot as plt"
41+
"import matplotlib.pyplot as plt\n",
42+
"import tempfile\n",
43+
"from pathlib import Path\n",
44+
"import platform"
4245
]
4346
},
4447
{
@@ -322,7 +325,9 @@
322325
")\n",
323326
"\n",
324327
"# generate a temporary SQLite DB\n",
325-
"abc_id = abc.new(\"sqlite:////tmp/mjp.db\", observations)"
328+
"prefix = \"sqlite:///\" if platform.system() == \"Windows\" else \"sqlite:////\"\n",
329+
"db_path = (Path(tempfile.gettempdir()).absolute() / \"mjp.db\").as_uri().replace(\"file:///\", prefix)\n",
330+
"abc_id = abc.new(db_path, observations)"
326331
]
327332
},
328333
{
@@ -474,7 +479,7 @@
474479
"\n",
475480
"# For BayesFlow devs: this ensures that the latest dev version can be found\n",
476481
"import sys\n",
477-
"sys.path.append('../')\n",
482+
"sys.path.append(\"../\")\n",
478483
"\n",
479484
"import bayesflow as bf"
480485
]
@@ -508,11 +513,11 @@
508513
"source": [
509514
"def prior_helper():\n",
510515
" \"\"\"The ABC prior returns a Parameter Object from pyabc which we convert to a dict.\"\"\"\n",
511-
" return dict(rate=prior.rvs()['rate'])\n",
516+
" return dict(rate=prior.rvs()[\"rate\"])\n",
512517
"\n",
513518
"def sim_helper(rate):\n",
514519
" \"\"\"The simulator returns a dict, we extract the output at the test times.\"\"\"\n",
515-
" temp = sim({'rate': rate})\n",
520+
" temp = sim({\"rate\": rate})\n",
516521
" xt_ind = np.searchsorted(temp[\"t\"], t_test_times) - 1\n",
517522
" obs = temp[\"X\"][:, 1][xt_ind]\n",
518523
" return dict(obs=obs)"
@@ -563,8 +568,8 @@
563568
],
564569
"source": [
565570
"adapter = bf.approximators.ContinuousApproximator.build_adapter(\n",
566-
" inference_variables='rate',\n",
567-
" inference_conditions='obs',\n",
571+
" inference_variables=\"rate\",\n",
572+
" inference_conditions=\"obs\",\n",
568573
" summary_variables=None\n",
569574
")\n",
570575
"adapter"
@@ -824,7 +829,7 @@
824829
"obs = observations[\"X\"][:, 1][xt_ind]\n",
825830
"\n",
826831
"# Obtain 1000 posterior samples\n",
827-
"samples = workflow.sample(conditions={'obs': [obs]}, num_samples=num_samples)"
832+
"samples = workflow.sample(conditions={\"obs\": [obs]}, num_samples=num_samples)"
828833
]
829834
},
830835
{
@@ -876,9 +881,9 @@
876881
"source": [
877882
"# abc gives us weighted samples, we resample them to get comparable samples\n",
878883
"df, w = abc_history.get_distribution()\n",
879-
"abc_samples = weighted_statistics.resample(df['rate'].values, w, 1000)\n",
884+
"abc_samples = weighted_statistics.resample(df[\"rate\"].values, w, 1000)\n",
880885
"\n",
881-
"f = bf.diagnostics.plots.pairs_posterior({'rate': abc_samples}, targets=np.array([true_rate]))"
886+
"f = bf.diagnostics.plots.pairs_posterior({\"rate\": abc_samples}, targets=np.array([true_rate]))"
882887
]
883888
},
884889
{

jupyter_execute/_examples/One_Sample_TTest.ipynb

Lines changed: 134 additions & 63 deletions
Large diffs are not rendered by default.

jupyter_execute/_examples/SIR_Posterior_Estimation.ipynb

Lines changed: 9 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -12,35 +12,24 @@
1212
},
1313
{
1414
"cell_type": "code",
15-
"execution_count": 1,
16-
"id": "0383ba66",
15+
"execution_count": null,
16+
"id": "5fb5c0f856b6bcf4",
1717
"metadata": {},
1818
"outputs": [],
1919
"source": [
2020
"import os\n",
2121
"# Set to your favorite backend\n",
22-
"os.environ[\"KERAS_BACKEND\"] = \"jax\""
22+
"if \"KERAS_BACKEND\" not in os.environ:\n",
23+
" # set this to \"torch\", \"tensorflow\", or \"jax\"\n",
24+
" os.environ[\"KERAS_BACKEND\"] = \"tensorflow\""
2325
]
2426
},
2527
{
2628
"cell_type": "code",
27-
"execution_count": 2,
28-
"id": "684f2d7e19d40e09",
29-
"metadata": {
30-
"ExecuteTime": {
31-
"end_time": "2025-04-11T19:54:02.700953Z",
32-
"start_time": "2025-04-11T19:53:33.926075Z"
33-
}
34-
},
35-
"outputs": [
36-
{
37-
"name": "stderr",
38-
"output_type": "stream",
39-
"text": [
40-
"WARNING:2025-04-21 12:41:48,425:jax._src.xla_bridge:967: An NVIDIA GPU may be present on this machine, but a CUDA-enabled jaxlib is not installed. Falling back to cpu.\n"
41-
]
42-
}
43-
],
29+
"execution_count": null,
30+
"id": "4a9355783f1314a",
31+
"metadata": {},
32+
"outputs": [],
4433
"source": [
4534
"import datetime\n",
4635
"\n",

jupyter_execute/_examples/Two_Moons_Starter.ipynb

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,11 @@
2424
"source": [
2525
"import os\n",
2626
"# Set to your favorite backend\n",
27-
"os.environ[\"KERAS_BACKEND\"] = \"jax\""
27+
"if \"KERAS_BACKEND\" not in os.environ:\n",
28+
" # set this to \"torch\", \"tensorflow\", or \"jax\"\n",
29+
" os.environ[\"KERAS_BACKEND\"] = \"tensorflow\"\n",
30+
"else:\n",
31+
" print(f\"Using '{os.environ['KERAS_BACKEND']}' backend\")"
2832
]
2933
},
3034
{

0 commit comments

Comments
 (0)