-
-
Notifications
You must be signed in to change notification settings - Fork 269
Update SMC-ABC_Lotka-Volterra_example.ipynb #590
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 2 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,7 +5,7 @@ jupytext: | |
format_name: myst | ||
format_version: 0.13 | ||
kernelspec: | ||
display_name: Python 3.9.7 ('base') | ||
display_name: Python 3 (ipykernel) | ||
language: python | ||
name: python3 | ||
--- | ||
|
@@ -166,8 +166,8 @@ def add_noise(a, b): | |
# plotting observed data. | ||
observed = add_noise(a, b) | ||
_, ax = plt.subplots(figsize=(12, 4)) | ||
ax.plot(observed[:, 0], "x", label="prey") | ||
ax.plot(observed[:, 1], "x", label="predator") | ||
ax.plot(t, observed[:, 0], "x", label="prey") | ||
ax.plot(t, observed[:, 1], "x", label="predator") | ||
ax.set_xlabel("time") | ||
ax.set_ylabel("population") | ||
ax.set_title("Observed data") | ||
|
@@ -198,8 +198,8 @@ az.plot_posterior(idata_lv); | |
# plot results | ||
_, ax = plt.subplots(figsize=(14, 6)) | ||
posterior = idata_lv.posterior.stack(samples=("draw", "chain")) | ||
ax.plot(observed[:, 0], "o", label="prey", c="C0", mec="k") | ||
ax.plot(observed[:, 1], "o", label="predator", c="C1", mec="k") | ||
ax.plot(t, observed[:, 0], "o", label="prey", c="C0", mec="k") | ||
ax.plot(t, observed[:, 1], "o", label="predator", c="C1", mec="k") | ||
ax.plot(competition_model(None, posterior["a"].mean(), posterior["b"].mean()), linewidth=3) | ||
for i in np.random.randint(0, size, 75): | ||
sim = competition_model(None, posterior["a"][i], posterior["b"][i]) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. and so do the two plot calls right under this line There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Weird I did run the pre-commit. I'll try again. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Oops I misinterpreted what you meant. I fixed this in f171270. |
||
|
@@ -224,3 +224,7 @@ martin2021bayesian | |
|
||
:::{include} ../page_footer.md | ||
::: | ||
|
||
```{code-cell} ipython3 | ||
|
||
``` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This also needs
t
as x values