Skip to content

Update notebook GLM-negative-binomial-regression to pymc v5 #573 #575

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 7 commits into from
Nov 23, 2023
Merged
Show file tree
Hide file tree
Changes from 3 commits
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
1 change: 0 additions & 1 deletion examples/case_studies/nyc_bym.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -634,7 +634,6 @@
"outputs": [],
"source": [
"with pm.Model(coords=coords) as BYM_model:\n",
"\n",
" # intercept\n",
" beta0 = pm.Normal(\"beta0\", 0, 1)\n",
"\n",
Expand Down
1 change: 0 additions & 1 deletion examples/case_studies/nyc_bym.myst.md
Original file line number Diff line number Diff line change
Expand Up @@ -319,7 +319,6 @@ Lastly, we'll use a Poisson outcome distribution. The number of traffic accident

```{code-cell} ipython3
with pm.Model(coords=coords) as BYM_model:

# intercept
beta0 = pm.Normal("beta0", 0, 1)

Expand Down

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -5,21 +5,23 @@ jupytext:
format_name: myst
format_version: 0.13
kernelspec:
display_name: Python 3.9.12 ('pymc-dev-py39')
display_name: pymc-dev
language: python
name: python3
name: pymc-dev
---

(GLM-negative-binomial-regression)=
# GLM: Negative Binomial Regression

:::{post} June, 2022
:::{post} September, 2023
:tags: negative binomial regression, generalized linear model,
:category: beginner
:author: Ian Ozsvald, Abhipsha Das, Benjamin Vincent
:author: Ian Ozsvald, Abhipsha Das, Benjamin Vincent, Wesley Boelrijk
:::

```{code-cell} ipython3
import warnings

import arviz as az
import numpy as np
import pandas as pd
Expand All @@ -30,10 +32,11 @@ from scipy import stats
```

```{code-cell} ipython3
warnings.simplefilter(action="ignore", category=FutureWarning)
RANDOM_SEED = 8927
rng = np.random.default_rng(RANDOM_SEED)

%config InlineBackend.figure_format = 'retina'
%config InlineBackend.figure_format = "retina"
az.style.use("arviz-darkgrid")
```

Expand Down Expand Up @@ -229,10 +232,11 @@ See also, [`bambi's` negative binomial example](https://bambinos.github.io/bambi
- Created by [Ian Ozsvald](https://github.com/ianozsvald)
- Updated by [Abhipsha Das](https://github.com/chiral-carbon) in August 2021
- Updated by [Benjamin Vincent](https://github.com/drbenvincent) to PyMC v4 in June 2022
- Updated by [Wesley Boelrijk](https://github.com/wesleyboelrijk) to PyMC v5 in September 2023

```{code-cell} ipython3
%load_ext watermark
%watermark -n -u -v -iv -w -p pytensor,aeppl,xarray
%watermark -n -u -v -iv -w -p pytensor,xarray
```

:::{include} ../page_footer.md
Expand Down
2 changes: 0 additions & 2 deletions examples/howto/model_builder.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@
"metadata": {},
"outputs": [],
"source": [

"from typing import Dict, List, Optional, Tuple, Union\n",
"\n",
"import arviz as az\n",
Expand Down Expand Up @@ -206,7 +205,6 @@
" self._generate_and_preprocess_model_data(X_values, y_values)\n",
"\n",
" with pm.Model(coords=self.model_coords) as self.model:\n",
"\n",
" # Create mutable data containers\n",
" x_data = pm.MutableData(\"x_data\", X_values)\n",
" y_data = pm.MutableData(\"y_data\", y_values)\n",
Expand Down
1 change: 0 additions & 1 deletion examples/howto/model_builder.myst.md
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,6 @@ class LinearModel(ModelBuilder):
self._generate_and_preprocess_model_data(X_values, y_values)

with pm.Model(coords=self.model_coords) as self.model:

# Create mutable data containers
x_data = pm.MutableData("x_data", X_values)
y_data = pm.MutableData("y_data", y_values)
Expand Down
1 change: 1 addition & 0 deletions requirements-docs.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,4 @@ sphinx-codeautolink
sphinx-notfound-page
matplotlib
sphinxext-rediraffe
seaborn