Skip to content

Commit

Permalink
fix the three tutorials (pyro-ppl#1571)
Browse files Browse the repository at this point in the history
  • Loading branch information
theorashid authored Mar 30, 2023
1 parent abe456c commit 0589859
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 25 deletions.
16 changes: 8 additions & 8 deletions examples/mortality.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,11 @@
.. math:: :nowrap:
\\begin{align}
\\alpha_{1s_1} & \\sim \\mathcal{N}(0,\\sigma_{\\alpha_{s_1}}^2) \\\\
\\alpha_{1s} & \\sim \\mathcal{N}(\\alpha_{1s_1(s_2)},\\sigma_{\\alpha_{s_2}}^2) \\\\
\\alpha_{2a} & \\sim \\mathcal{N}(\\alpha_{2,a-1},\\sigma_{\\alpha_a}^2) \\quad \\alpha_{2,0} = \\alpha_0 \\\\
\\beta_{2a} & \\sim \\mathcal{N}(\\beta_{2,a-1},\\sigma_{\\beta_a}^2) \\quad \\beta_{2,0} = \\beta_0 \\\\
\\pi_{t} & \\sim \\mathcal{N}(\\pi_{t-1},\\sigma_{\\pi}^2), \\quad \\pi_{0} = 0 \\\\
\\alpha_{1s_1} & \\sim \\text{Normal}(0,\\sigma_{\\alpha_{s_1}}^2) \\\\
\\alpha_{1s} & \\sim \\text{Normal}(\\alpha_{1s_1(s_2)},\\sigma_{\\alpha_{s_2}}^2) \\\\
\\alpha_{2a} & \\sim \\text{Normal}(\\alpha_{2,a-1},\\sigma_{\\alpha_a}^2) \\quad \\alpha_{2,0} = \\alpha_0 \\\\
\\beta_{2a} & \\sim \\text{Normal}(\\beta_{2,a-1},\\sigma_{\\beta_a}^2) \\quad \\beta_{2,0} = \\beta_0 \\\\
\\pi_{t} & \\sim \\text{Normal}(\\pi_{t-1},\\sigma_{\\pi}^2), \\quad \\pi_{0} = 0 \\\\
\\text{logit}(m_{ast}) & = \\alpha_{1s} + \\alpha_{2a} + \\beta_{2a} t + \\pi_{t}
\\end{align}
Expand All @@ -46,9 +46,9 @@
.. math:: :nowrap:
\\begin{align}
\\alpha_0 & \\sim \\mathcal{N}(0,10), \\\\
\\beta_0 & \\sim \\mathcal{N}(0,10), \\\\
\\sigma_i & \\sim \\mathcal{N}^{+}(1)
\\alpha_0 & \\sim \\text{Normal}(0,10), \\\\
\\beta_0 & \\sim \\text{Normal}(0,10), \\\\
\\sigma_i & \\sim \\text{Half-Normal}(1)
\\end{align}
Further detail about the model terms can be found in [1].
Expand Down
31 changes: 16 additions & 15 deletions notebooks/source/bayesian_hierarchical_linear_regression.ipynb

Large diffs are not rendered by default.

5 changes: 3 additions & 2 deletions notebooks/source/tbip.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -240,6 +240,7 @@
]
},
{
"attachments": {},
"cell_type": "markdown",
"metadata": {
"id": "n8SUSFpLuXRP"
Expand All @@ -256,8 +257,8 @@
"We use lognormal factors for the positive variables and Gaussian factors for the real variables:\n",
"$$q(\\theta_{dk}) = \\text{LogNormal}(\\mu_{\\theta_{dk}}\\sigma^2_{\\theta_{dk}})$$\n",
"$$q(\\theta_{dv}) = \\text{LogNormal}(\\mu_{\\beta_{kv}}, \\sigma^2_{\\beta_{kv}})$$\n",
"$$q(\\eta_{kv}) = \\mathcal{N}(\\mu_{\\eta_{kv}}, \\sigma^2_{\\eta_{kv}})$$\n",
"$$q(x_s) = \\mathcal{N}(\\mu_{x_s}, \\sigma^2_{x_s}).$$\n",
"$$q(\\eta_{kv}) = \\text{Normal}(\\mu_{\\eta_{kv}}, \\sigma^2_{\\eta_{kv}})$$\n",
"$$q(x_s) = \\text{Normal}(\\mu_{x_s}, \\sigma^2_{x_s}).$$\n",
"\n",
"Thus, our goal is to maximize the ELBO with respect to $\\phi = \\{\\mu_\\theta, \\sigma_\\theta, \\mu_\\beta, \\sigma_\\beta,\\mu_\\eta, \\sigma_\\eta, \\mu_x, \\sigma_x\\}$. \n",
"\n",
Expand Down

0 comments on commit 0589859

Please sign in to comment.