Skip to content

Commit

Permalink
re-running pre-commit
Browse files Browse the repository at this point in the history
  • Loading branch information
yahrMason committed Jan 13, 2024
1 parent 34a6baf commit da1021c
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 15 deletions.
8 changes: 5 additions & 3 deletions Rethinking_2/Chp_05.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -490,8 +490,8 @@
"\n",
"x = np.linspace(-2, 2, 50)\n",
"\n",
"prior_samp_a = az.extract(idata_5_1, group = \"prior\", var_names=\"a\").to_numpy()[:50]\n",
"prior_samp_bA = az.extract(idata_5_1, group = \"prior\", var_names=\"bA\").to_numpy()[:50]\n",
"prior_samp_a = az.extract(idata_5_1, group=\"prior\", var_names=\"a\").to_numpy()[:50]\n",
"prior_samp_bA = az.extract(idata_5_1, group=\"prior\", var_names=\"bA\").to_numpy()[:50]\n",
"\n",
"for a, ba in zip(prior_samp_a, prior_samp_bA):\n",
" y = a + ba * x\n",
Expand Down Expand Up @@ -2396,7 +2396,9 @@
],
"source": [
"mu = marriage_mu_counterfactual.T\n",
"sigma = az.extract(idata_5_3_A_marriage_ppc, group=\"posterior_predictive\", var_names=\"sigma_m\").to_numpy()\n",
"sigma = az.extract(\n",
" idata_5_3_A_marriage_ppc, group=\"posterior_predictive\", var_names=\"sigma_m\"\n",
").to_numpy()\n",
"M_sim = stats.norm(loc=mu, scale=sigma).rvs()\n",
"M_sim.shape"
]
Expand Down
4 changes: 2 additions & 2 deletions Rethinking_2/Chp_08.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -1951,11 +1951,11 @@
"source": [
"with m_8_4:\n",
" prior_8_4 = pm.sample_prior_predictive(var_names=[\"a\", \"bw\", \"bs\"])\n",
" prior_8_4 = az.extract(prior_8_4, group = \"prior\")\n",
" prior_8_4 = az.extract(prior_8_4, group=\"prior\")\n",
"\n",
"with m_8_5:\n",
" prior_8_5 = pm.sample_prior_predictive(var_names=[\"a\", \"bw\", \"bs\", \"bws\"])\n",
" prior_8_5 = az.extract(prior_8_5, group = \"prior\")"
" prior_8_5 = az.extract(prior_8_5, group=\"prior\")"
]
},
{
Expand Down
7 changes: 2 additions & 5 deletions Rethinking_2/Chp_09.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,8 @@
"import pandas as pd\n",
"import pymc as pm\n",
"\n",
"from scipy import stats\n",
"from numpy.random import default_rng\n",
"\n",
"from scipy import stats\n",
"\n",
"warnings.simplefilter(action=\"ignore\", category=FutureWarning)\n",
"pd.set_option(\"mode.chained_assignment\", None)"
Expand Down Expand Up @@ -1163,9 +1162,7 @@
"source": [
"# Figure 9.10\n",
"with m_9_3:\n",
" m_9_3_prior = az.extract(\n",
" pm.sample_prior_predictive(var_names=[\"alpha\", \"sigma\"])[\"prior\"]\n",
" )\n",
" m_9_3_prior = az.extract(pm.sample_prior_predictive(var_names=[\"alpha\", \"sigma\"])[\"prior\"])\n",
" m_9_3_post = az.extract(idata_9_3, group=\"posterior\", var_names=[\"alpha\", \"sigma\"])\n",
"\n",
"_, axs = plt.subplots(1, 2, figsize=[8, 3.5], constrained_layout=True)\n",
Expand Down
4 changes: 3 additions & 1 deletion Rethinking_2/Chp_12.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -480,7 +480,9 @@
"source": [
"gender_ = \"female\"\n",
"x_plot = np.linspace(0, 1, 100)\n",
"post_theta = az.extract(idata_12_1.sel(gender=gender_), group=\"posterior\", var_names=\"theta\").to_numpy()\n",
"post_theta = az.extract(\n",
" idata_12_1.sel(gender=gender_), group=\"posterior\", var_names=\"theta\"\n",
").to_numpy()\n",
"\n",
"# draw posterior mean beta distribution:\n",
"pbar_mean = logistic(post_a.sel(gender=gender_)).mean()\n",
Expand Down
4 changes: 1 addition & 3 deletions Rethinking_2/Chp_14.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -834,9 +834,7 @@
"ax.text(0, 0.8, \"prior\", horizontalalignment=\"center\")\n",
"\n",
"az.plot_kde(\n",
" np.array(\n",
" az.extract(post[\"Rho\"].sel(chol_cov_corr_dim_0=1, chol_cov_corr_dim_1=0)).to_array()\n",
" ),\n",
" np.array(az.extract(post[\"Rho\"].sel(chol_cov_corr_dim_0=1, chol_cov_corr_dim_1=0)).to_array()),\n",
" ax=ax,\n",
" plot_kwargs={\"color\": \"C0\"},\n",
")\n",
Expand Down
2 changes: 1 addition & 1 deletion Rethinking_2/Chp_16.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -920,7 +920,7 @@
" )\n",
"\n",
" # Compute log ( p_s * Pr(y_i|s) )\n",
" phi = pt.concatenate([p[None] for p in phi] , axis=0)\n",
" phi = pt.concatenate([p[None] for p in phi], axis=0)\n",
" phi = pt.log(phi) + pt.log(p[:, None])\n",
"\n",
" # Compute average log-probability of y_i\n",
Expand Down

0 comments on commit da1021c

Please sign in to comment.