commit c0eeb82fd776a42ddd7b18b2ef6a17d36bd126b9
parent b7f4c02547354368267ecbc0b8eb47d8b03ad215
Author: Silas Brack <s174433@student.dtu.dk>
Date: Tue, 7 Feb 2023 19:10:49 +0100
Moved things.
Diffstat:
2 files changed, 7 insertions(+), 7 deletions(-)
diff --git a/chapters/experiments.tex b/chapters/experiments.tex
@@ -16,7 +16,7 @@ We then sample from the posterior and visualise the posterior predictive samples
\begin{marginfigure}
\centering
\includegraphics{sin_posterior_predictive_bothalphas_clear.pdf}
- \caption[Laplace predictive posterior for a sine curve.]{Laplace predictive posterior (with a confidence interval given by one standard deviation) for a multilayer perceptron (MLP) modelling \(f(x) = \sin(5 x + 1)\) with parameters trained on the marginal likelihood for a fixed prior precision \(\alpha = 70\) (top) and \(\alpha = 1\) (bottom). We compute the marginal using our approximate lower bound and sample from the posterior using our approximate sampling scheme. The choice of prior precision has a large effect on the posterior uncertainty, but, when it is chosen appropriately, our approximate methods are able to learn a reasonable predictive distribution (i.e., more uncertainty in the regions with no data) with a similar mean prediction to the MSE-optimised network.}
+ \caption[Laplace predictive posterior for a sine curve.]{Laplace predictive posterior (with a confidence interval given by one standard deviation) for a multilayer perceptron modelling \(f(x) = \sin(5 x + 1)\) with parameters trained on the marginal likelihood for a fixed prior precision \(\alpha = 70\) (top) and \(\alpha = 1\) (bottom). We compute the marginal using our approximate lower bound and sample from the posterior using our approximate sampling scheme. The choice of prior precision has a large effect on the posterior uncertainty, but, when it is chosen appropriately, our approximate methods are able to learn a reasonable predictive distribution (i.e., more uncertainty in the regions with no data) with a similar mean prediction to the MSE-optimised network.}
\label{fig:sin}
\end{marginfigure}
diff --git a/chapters/sampling.tex b/chapters/sampling.tex
@@ -20,7 +20,6 @@ Using the Laplace approximation, we estimate the precision matrix as the Hessian
Because of this, the covariance matrix is given by the inverse of this Hessian, and we thus sample from the Laplace-approximate posterior distribution as
\begin{align}\label{eq:sample-laplace}
\bm \varepsilon = \bm \theta_{\textsc{map}} + \bm \Lambda^{-1/2} \bm \varepsilon_0,
- % \bm \varepsilon = \bm \mu + \bm \Lambda^{-1/2} \bm \varepsilon_0,
\end{align}
where \(\bm \Lambda = \nabla^2_{\bm\theta} \log p(\bm \theta \given \bm y)\).
In \cref{eq:sample-reparam}, the square root of a matrix yields another matrix which, when multiplied by itself, is equal to the original matrix.
@@ -158,6 +157,12 @@ As such, since \(\Im(\sigma)^2\) must be positive, \(\tau\) must then be real-va
In practice, we incorporate the \(1 / (\pi i)\) term into the quadrature weights and, since \(\Tilde{w}_q\) also happens to be real-valued and negative, we can redefine the quadrature weights \(w_q = -\Tilde{w}_q\) and the quadrature points \(t_q = -\sigma^2_q\) for simplicity.\marginnote{With this redefinition, both \(w_q > 0\) and \(t_q > 0\). This then means that \(\left(t_q \identity + \bm K\right)\) is positive definite.}
This yields the quadrature rule result \(\bm K^{-1/2} \bm v \approx \sum^Q_{q=1} w_q \bm c_q\), where \(\bm c_q = (t_q \identity + \bm K)^{-1}\).
+\begin{marginfigure}
+ \includegraphics[scale=1]{ellipk.pdf}
+ \caption[Comparison of SciPy and JAX \texttt{ellipk} implementations.]{Comparison of SciPy and JAX \texttt{ellipk} implementations. For values for which the complete elliptic integral \(K(p)\) is well-defined, both implementations yield the same results. Furthermore, due to its static nature, JAX implementation is compatible with \emph{just-in-time} compilation.}
+ \label{fig:ellipk}
+\end{marginfigure}
+
This change of variables from \(\tau\) to \(\sigma\) yields a set of quadrature weights \(w_1, \ldots, w_Q\) given by
\begin{align}\label{eq:quadrature-weights}
w_q = \frac{2 \sqrt{\lambda_\mathrm{min}}}{\pi Q} \mathcal{K}^\prime (k) \cdot \cn(i u_q \mathcal{K}^\prime (k) \given k) \cdot \dn (i u_q \mathcal{K}^\prime (k) \given k),
@@ -189,11 +194,6 @@ We can thereby now compute the quadrature weights and shifts, as seen in \cref{a
% where \(\sn\), \(\cn\), and \(\dn\) are the Jacobi elliptic functions and the complete elliptic integral is \(\mathcal{K}^\prime(k) = \mathcal{K}(k^\prime) = \mathcal{K}(\sqrt{1 - k^2})\) (see \cref{sec:jacobi-elliptic}).
% To compute these values, we also use the elliptic modulus \(k = \kappa(\bm K)^{-1/2}\) (where \(\kappa(\bm K)\) denotes the condition number of \(\bm K\)), and \(u_q = (q - 1/2) / Q\).
% We can thereby now compute the quadrature weights and shifts, as seen in \cref{alg:quad}.
-\begin{marginfigure}
- \includegraphics[scale=1]{ellipk.pdf}
- \caption[Comparison of SciPy and JAX \texttt{ellipk} implementations.]{Comparison of SciPy and JAX \texttt{ellipk} implementations. For values for which the complete elliptic integral \(K(p)\) is well-defined, both implementations yield the same results. Furthermore, due to its static nature, JAX implementation is compatible with \emph{just-in-time} compilation.}
- \label{fig:ellipk}
-\end{marginfigure}
\begin{figure}
\centering