Skip to content

Commit

Permalink
Replacing PyMC3 plots w/ Arviz plots & sigma Param change [Part 5] (#23)
Browse files Browse the repository at this point in the history
* 🎨 Update plots from pymc to arviz dependencies & replace param sd with sigma

* ⏪ Revert metadata changes in notebooks

* 🐛 Set core=1 on pm.sample and update submodule reference

* 🎨 Add version for Pymc3 and remove warnings import
  • Loading branch information
CloudChaoszero authored Mar 21, 2021
1 parent 48af2ff commit 1ba7529
Show file tree
Hide file tree
Showing 3 changed files with 504 additions and 188 deletions.
10 changes: 5 additions & 5 deletions examples/mixture_models/gaussian_mixture_model.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
"name": "stdout",
"output_type": "stream",
"text": [
"Fri 12 Jun 2020 07:12:54 PM UTC\r\n",
"Fri 12 Jun 2020 07:12:54 PM UTC\n",
"Running on PyMC3 v3.9.0\n"
]
}
Expand Down Expand Up @@ -218,7 +218,7 @@
}
],
"source": [
"pm.traceplot(tr, var_names=[\"p\", \"sd\", \"means\"]);"
"az.plot_trace(tr, var_names=[\"p\", \"sd\", \"means\"]);"
]
},
{
Expand Down Expand Up @@ -259,7 +259,7 @@
],
"source": [
"# take a look at traceplot for some model parameters\n",
"pm.plots.traceplot(tr[::5], var_names=[\"p\", \"sd\", \"means\"]);"
"az.plot_trace(tr[::5], var_names=[\"p\", \"sd\", \"means\"]);"
]
},
{
Expand Down Expand Up @@ -293,7 +293,7 @@
],
"source": [
"# I prefer autocorrelation plots for serious confirmation of MCMC convergence\n",
"pm.autocorrplot(tr[::5], var_names=[\"sd\"]);"
"az.plot_autocorr(tr[::5], var_names=[\"sd\"]);"
]
},
{
Expand Down Expand Up @@ -434,7 +434,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.7.7"
"version": "3.8.5"
},
"latex_envs": {
"bibliofile": "biblio.bib",
Expand Down
14 changes: 7 additions & 7 deletions examples/ode_models/ODE_API_shapes_and_benchmarking.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
"source": [
"import logging\n",
"\n",
"import arviz\n",
"import matplotlib.pyplot as plt\n",
"import numpy as np\n",
"import pymc3 as pm\n",
Expand All @@ -40,7 +41,6 @@
"# this notebook show DEBUG log messages\n",
"logging.getLogger(\"pymc3\").setLevel(logging.DEBUG)\n",
"\n",
"import arviz\n",
"import IPython.display"
]
},
Expand Down Expand Up @@ -144,7 +144,7 @@
" sigma = pm.HalfCauchy(\"sigma\", 1)\n",
" vmax = pm.Lognormal(\"vmax\", 0, 1)\n",
" K_S = pm.Lognormal(\"K_S\", 0, 1)\n",
" s0 = pm.Normal(\"red_0\", mu=10, sd=2)\n",
" s0 = pm.Normal(\"red_0\", mu=10, sigma=2)\n",
"\n",
" y_hat = pm.ode.DifferentialEquation(\n",
" func=Chem.reaction, times=times, n_states=len(y0_true), n_theta=len(theta_true)\n",
Expand All @@ -153,8 +153,8 @@
" red_hat = y_hat.T[0][red]\n",
" blue_hat = y_hat.T[1][blue]\n",
"\n",
" Y_red = pm.Normal(\"Y_red\", mu=red_hat, sd=sigma, observed=y_obs_1)\n",
" Y_blue = pm.Normal(\"Y_blue\", mu=blue_hat, sd=sigma, observed=y_obs_2)\n",
" Y_red = pm.Normal(\"Y_red\", mu=red_hat, sigma=sigma, observed=y_obs_1)\n",
" Y_blue = pm.Normal(\"Y_blue\", mu=blue_hat, sigma=sigma, observed=y_obs_2)\n",
"\n",
" return pmodel\n",
"\n",
Expand Down Expand Up @@ -353,9 +353,9 @@
],
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"display_name": "Python (PyMC3 Dev)",
"language": "python",
"name": "python3"
"name": "pymc3-dev"
},
"language_info": {
"codemirror_mode": {
Expand All @@ -367,7 +367,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.6.10"
"version": "3.8.5"
}
},
"nbformat": 4,
Expand Down
668 changes: 492 additions & 176 deletions examples/ode_models/ODE_with_manual_gradients.ipynb

Large diffs are not rendered by default.

0 comments on commit 1ba7529

Please sign in to comment.