Skip to content
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

Use networkx instead of causalgraphicalmodels #31

Merged
merged 17 commits into from
Feb 16, 2024
Prev Previous commit
fix chapter 8
fehiepsi committed Feb 16, 2024
commit 7de912d87650d9f30a80667a07f966d4acbfd644
3 changes: 3 additions & 0 deletions notebooks/08_conditional_manatees.ipynb
Original file line number Diff line number Diff line change
@@ -508,6 +508,7 @@
"rugged_seq = jnp.linspace(start=-1, stop=1.1, num=30)\n",
"\n",
"# compute mu over samples, fixing cid=1\n",
"post.pop(\"mu\")\n",
"predictive = Predictive(m8_2.model, post, return_sites=[\"mu\"])\n",
"mu_NotAfrica = predictive(random.PRNGKey(2), cid=1, rugged_std=rugged_seq)[\"mu\"]\n",
"\n",
@@ -814,6 +815,7 @@
"source": [
"rugged_seq = jnp.linspace(start=-0.2, stop=1.2, num=30)\n",
"post = m8_3.sample_posterior(random.PRNGKey(1), p8_3, sample_shape=(1000,))\n",
"post.pop(\"mu\")\n",
"predictive = Predictive(m8_3.model, post, return_sites=[\"mu\"])\n",
"muA = predictive(random.PRNGKey(2), cid=0, rugged_std=rugged_seq)[\"mu\"]\n",
"muN = predictive(random.PRNGKey(2), cid=1, rugged_std=rugged_seq)[\"mu\"]\n",
@@ -1130,6 +1132,7 @@
" ax.scatter(d.water_cent[idx], d.blooms_std[idx])\n",
" ax.set(xlim=(-1.1, 1.1), ylim=(-0.1, 1.1), xlabel=\"water\", ylabel=\"blooms\")\n",
" post = m8_4.sample_posterior(random.PRNGKey(1), p8_4, sample_shape=(1000,))\n",
" post.pop(\"mu\")\n",
" mu = Predictive(m8_4.model, post, return_sites=[\"mu\"])(\n",
" random.PRNGKey(2), shade_cent=s, water_cent=jnp.arange(-1, 2)\n",
" )[\"mu\"]\n",