Skip to content

Commit

Permalink
Update SMC-ABC_Lotka-Volterra_example.ipynb
Browse files Browse the repository at this point in the history
Added the time array to the plots to correctly represent the independent variable in 2 plots.
  • Loading branch information
PRKramer authored Nov 15, 2023
1 parent bed70e3 commit ad4d93d
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions examples/samplers/SMC-ABC_Lotka-Volterra_example.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -456,8 +456,8 @@
"# plotting observed data.\n",
"observed = add_noise(a, b)\n",
"_, ax = plt.subplots(figsize=(12, 4))\n",
"ax.plot(observed[:, 0], \"x\", label=\"prey\")\n",
"ax.plot(observed[:, 1], \"x\", label=\"predator\")\n",
"ax.plot(t,observed[:, 0], \"x\", label=\"prey\")\n",
"ax.plot(t,observed[:, 1], \"x\", label=\"predator\")\n",
"ax.set_xlabel(\"time\")\n",
"ax.set_ylabel(\"population\")\n",
"ax.set_title(\"Observed data\")\n",
Expand Down Expand Up @@ -603,8 +603,8 @@
"# plot results\n",
"_, ax = plt.subplots(figsize=(14, 6))\n",
"posterior = idata_lv.posterior.stack(samples=(\"draw\", \"chain\"))\n",
"ax.plot(observed[:, 0], \"o\", label=\"prey\", c=\"C0\", mec=\"k\")\n",
"ax.plot(observed[:, 1], \"o\", label=\"predator\", c=\"C1\", mec=\"k\")\n",
"ax.plot(t,observed[:, 0], \"o\", label=\"prey\", c=\"C0\", mec=\"k\")\n",
"ax.plot(t,observed[:, 1], \"o\", label=\"predator\", c=\"C1\", mec=\"k\")\n",
"ax.plot(competition_model(None, posterior[\"a\"].mean(), posterior[\"b\"].mean()), linewidth=3)\n",
"for i in np.random.randint(0, size, 75):\n",
" sim = competition_model(None, posterior[\"a\"][i], posterior[\"b\"][i])\n",
Expand Down

0 comments on commit ad4d93d

Please sign in to comment.