From e8fca0cb0ae51c1c73fefe5ac13abde6e6fcb794 Mon Sep 17 00:00:00 2001
From: udlbook <110402648+udlbook@users.noreply.github.com>
Date: Mon, 15 Apr 2024 14:34:23 -0400
Subject: [PATCH] Added notation explanation
---
Notebooks/Chap09/9_4_Bayesian_Approach.ipynb | 32 +++++++-------------
1 file changed, 11 insertions(+), 21 deletions(-)
diff --git a/Notebooks/Chap09/9_4_Bayesian_Approach.ipynb b/Notebooks/Chap09/9_4_Bayesian_Approach.ipynb
index 25eac22..b5d77f9 100644
--- a/Notebooks/Chap09/9_4_Bayesian_Approach.ipynb
+++ b/Notebooks/Chap09/9_4_Bayesian_Approach.ipynb
@@ -1,18 +1,16 @@
{
"cells": [
{
- "attachments": {},
"cell_type": "markdown",
"metadata": {
- "colab_type": "text",
- "id": "view-in-github"
+ "id": "view-in-github",
+ "colab_type": "text"
},
"source": [
"
"
]
},
{
- "attachments": {},
"cell_type": "markdown",
"metadata": {
"id": "el8l05WQEO46"
@@ -159,7 +157,6 @@
]
},
{
- "attachments": {},
"cell_type": "markdown",
"metadata": {
"id": "i8T_QduzeBmM"
@@ -195,7 +192,6 @@
]
},
{
- "attachments": {},
"cell_type": "markdown",
"metadata": {
"id": "JojV6ueRk49G"
@@ -211,7 +207,6 @@
]
},
{
- "attachments": {},
"cell_type": "markdown",
"metadata": {
"id": "YX0O_Ciwp4W1"
@@ -277,7 +272,6 @@
]
},
{
- "attachments": {},
"cell_type": "markdown",
"metadata": {
"id": "GjPnlG4q0UFK"
@@ -334,7 +328,6 @@
]
},
{
- "attachments": {},
"cell_type": "markdown",
"metadata": {
"id": "GiNg5EroUiUb"
@@ -343,17 +336,16 @@
"Now we need to perform inference for a new data points $\\mathbf{x}^*$ with corresponding hidden values $\\mathbf{h}^*$. Instead of having a single estimate of the parameters, we have a distribution over the possible parameters. So we marginalize (integrate) over this distribution to account for all possible values:\n",
"\n",
"\\begin{align}\n",
- "Pr(y^*|\\mathbf{x}^*) &=& \\int Pr(y^{*}|\\mathbf{x}^*,\\boldsymbol\\phi)Pr(\\boldsymbol\\phi|\\{\\mathbf{x}_{i},\\mathbf{y}_{i}\\}) d\\boldsymbol\\phi\\\\\n",
- "&=& \\int \\text{Norm}_{y^*}\\bigl[[\\mathbf{h}^{*T},1]\\boldsymbol\\phi,\\sigma^2\\bigr]\\cdot\\text{Norm}_{\\boldsymbol\\phi}\\biggl[\\frac{1}{\\sigma^2}\\left(\\frac{1}{\\sigma^2}\\mathbf{H}\\mathbf{H}^T+\\frac{1}{\\sigma_p^2}\\mathbf{I}\\right)^{-1}\\mathbf{H}\\mathbf{y},\\left(\\frac{1}{\\sigma^2}\\mathbf{H}\\mathbf{H}^T+\\frac{1}{\\sigma_p^2}\\mathbf{I}\\right)^{-1}\\biggr]d\\boldsymbol\\phi\\\\\n",
- "&=& \\text{Norm}_{y^*}\\biggl[\\frac{1}{\\sigma^2} [\\mathbf{h}^{*T},1]\\left(\\frac{1}{\\sigma^2}\\mathbf{H}\\mathbf{H}^T+\\frac{1}{\\sigma_p^2}\\mathbf{I}\\right)^{-1}\\mathbf{H}\\mathbf{y}, [\\mathbf{h}^{*T},1]\\left(\\frac{1}{\\sigma^2}\\mathbf{H}\\mathbf{H}^T+\\frac{1}{\\sigma_p^2}\\mathbf{I}\\right)^{-1}\n",
- "[\\mathbf{h}^*;1]\\biggr]\n",
+ "Pr(y^*|\\mathbf{x}^*) &= \\int Pr(y^{*}|\\mathbf{x}^*,\\boldsymbol\\phi)Pr(\\boldsymbol\\phi|\\{\\mathbf{x}_{i},\\mathbf{y}_{i}\\}) d\\boldsymbol\\phi\\\\\n",
+ "&= \\int \\text{Norm}_{y^*}\\bigl[[\\mathbf{h}^{*T},1]\\boldsymbol\\phi,\\sigma^2\\bigr]\\cdot\\text{Norm}_{\\boldsymbol\\phi}\\biggl[\\frac{1}{\\sigma^2}\\left(\\frac{1}{\\sigma^2}\\mathbf{H}\\mathbf{H}^T+\\frac{1}{\\sigma_p^2}\\mathbf{I}\\right)^{-1}\\mathbf{H}\\mathbf{y},\\left(\\frac{1}{\\sigma^2}\\mathbf{H}\\mathbf{H}^T+\\frac{1}{\\sigma_p^2}\\mathbf{I}\\right)^{-1}\\biggr]d\\boldsymbol\\phi\\\\\n",
+ "&= \\text{Norm}_{y^*}\\biggl[\\frac{1}{\\sigma^2} [\\mathbf{h}^{*T},1]\\left(\\frac{1}{\\sigma^2}\\mathbf{H}\\mathbf{H}^T+\\frac{1}{\\sigma_p^2}\\mathbf{I}\\right)^{-1}\\mathbf{H}\\mathbf{y}, [\\mathbf{h}^{*T},1]\\left(\\frac{1}{\\sigma^2}\\mathbf{H}\\mathbf{H}^T+\\frac{1}{\\sigma_p^2}\\mathbf{I}\\right)^{-1}\n",
+ "[\\mathbf{h}^*;1]\\biggr],\n",
"\\end{align}\n",
"\n",
+ "where the notation $[\\mathbf{h}^{*T},1]$ is a row vector containing $\\mathbf{h}^{T}$ with a one appended to the end and $[\\mathbf{h};1 ]$ is a column vector containing $\\mathbf{h}$ with a one appended to the end.\n",
"\n",
"\n",
- "\n",
- "To compute this, we reformulated the integrand using the relations from appendices\n",
- "C.3.3 and C.3.4 as the product of a normal distribution in $\\boldsymbol\\phi$ and a constant with respect\n",
+ "To compute this, we reformulated the integrand using the relations from appendices C.3.3 and C.3.4 as the product of a normal distribution in $\\boldsymbol\\phi$ and a constant with respect\n",
"to $\\boldsymbol\\phi$. The integral of the normal distribution must be one, and so the final result is just the constant. This constant is itself a normal distribution in $y^*$.
\n",
"\n",
"If you feel so inclined you can work through the math of this yourself.\n",
@@ -404,7 +396,6 @@
]
},
{
- "attachments": {},
"cell_type": "markdown",
"metadata": {
"id": "8Hcbe_16sK0F"
@@ -419,9 +410,8 @@
],
"metadata": {
"colab": {
- "authorship_tag": "ABX9TyMB8B4269DVmrcLoCWrhzKF",
- "include_colab_link": true,
- "provenance": []
+ "provenance": [],
+ "include_colab_link": true
},
"kernelspec": {
"display_name": "Python 3",
@@ -433,4 +423,4 @@
},
"nbformat": 4,
"nbformat_minor": 0
-}
+}
\ No newline at end of file