Skip to content

Update ModelBuilder to show regression lines #538

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

Merged
merged 4 commits into from
Apr 6, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
277 changes: 27 additions & 250 deletions examples/howto/model_builder.ipynb

Large diffs are not rendered by default.

10 changes: 7 additions & 3 deletions examples/howto/model_builder.myst.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ jupytext:
format_name: myst
format_version: 0.13
kernelspec:
display_name: pymc5
display_name: pymc-dev
language: python
name: pymc5
name: python3
---

# Using ModelBuilder class for deploying PyMC models
Expand Down Expand Up @@ -271,8 +271,12 @@ After using the `predict()`, we can plot our data and see graphically how satisf
fig, ax = plt.subplots(figsize=(7, 7))
ax.plot(
x_pred,
marker="x",
label="predict",
),
ax.plot(
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The changes are modifying an x vs y plot to two line plots where the x axis is always an arange and the y axis is mapped to the values in the 1st plot and to the y values in the 2nd plot. Mapping these two different quantities to the same axis is definitely wrong and should be changed. I think what @fonnesbeck wanted in the issue was having both scatter x vs y of the predictions along with the x vs y of the regressions lines from the model that generated those predictions. It would have a similar look to the last image in https://www.pymc.io/projects/examples/en/latest/generalized_linear_models/GLM-robust.html but with the x_pred / pred_means["y"] as the scatter instead of truth valued and no true regression line

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, I get the picture now, I will work on it

pred_mean["y"],
"x",
marker="x",
label="predict",
)
ax.set(title="Posterior predictive regression lines", xlabel="x", ylabel="y")
Expand Down