Tom Charnock
Institut d'Astrophysique de Paris
Notebook: presentation.charnock.fr/ED
|
|
|
|
|






Data ${\bf d}$ described by parameters $\boldsymbol{\theta}$ with likelihood $\mathcal{L}({\bf d}|\boldsymbol{\theta})$
Posterior of parameters $\boldsymbol{\theta}$ found using Bayes theorem
$$\mathcal{P}(\boldsymbol{\theta}|{\bf d})=\frac{\mathcal{L}({\bf d}|\boldsymbol{\theta})p(\boldsymbol{\theta})}{p({\bf d})}$$Any function* can be approximated with a mixture of distributions
*under certain conditions

With MDNs we have to assume a final distribution (mixture of Gaussians, etc.)
We also work only on the posterior distribution (or the likelihood if we work backwards)
The joint space of data and parameters $\boldsymbol{\psi}=\{{\bf d}, \boldsymbol{\theta}\}$ and networks help learn the true distribution
A simple way to learn this space is by making a guess for the distribution and then squashing and squeezing it into place.
This can be done using normalising flows $\mathscr{f}:\boldsymbol{\psi}\to\boldsymbol{\chi}$ - a series of invertible transformation of the initial distribution $$\mathscr{f} = \mathscr{f}_0 \odot \mathscr{f}_1 \odot \cdots \odot \mathscr{f}_k$$
The joint distribution (which can be complex and weird) is found using
$$\mathcal{P}(\boldsymbol{\psi}) = \mathcal{P}_\boldsymbol{\chi}(\mathscr{f}^{-1}(\boldsymbol{\psi}))\left|\textrm{det}\frac{\partial\mathscr{f}^{-1}}{\partial\boldsymbol{\psi}}\right|$$where the initial guess $\mathcal{P}_\boldsymbol{\chi}$ can be simple.
We can build probability distribution out of conditional probability distributions
$$\mathcal{P}(\boldsymbol{\psi})=\prod_{d=1}^D\mathcal{P}(\psi_d|\psi_{1:d−1})$$Each conditional probability distribution depends on all of the previous inputs from the input vector.
A neural network with variable input sizes predicts MDN-like parameters


It would be great if we could understand how uncertain we are about our network's outputs.
To do so we must think statistically again!
A network is just a universal map
$$\mathscr{f}_\boldsymbol{v}:\mathbb{R}^{d}\to \mathbb{R}^{x}$$where an input ${\bf d}$ is mapped to an output ${\bf x}=\mathscr{f}({\bf d}, \boldsymbol{v})$ where $\mathscr{f}$ is tuned via trainable parameters, $\boldsymbol{v}$.
The probability of getting output ${\bf x}$ given some set of network parameters $\boldsymbol{v}$ and input data ${\bf d}$ is described by $\mathcal{L}({\bf x}|\boldsymbol{v},{\bf d})$.
$$\mathcal{P}(\boldsymbol{v}|{\bf x},{\bf d}) = \frac{\mathcal{L}({\bf x}|\boldsymbol{v},{\bf d})p(\boldsymbol{v}|{\bf d})}{p({\bf x}|{\bf d})}$$Unfortunately you can't - but you can try and understand your output in terms of the network parameters
There are several ways to do this
Unfortunately it doesn't really work unless you have LOADS of networks.
(A bit dangerous - but less so than not doing it)
Optimise the network using the KL-divergence (statistical difference measure (measure of the Shannon information)) between $\mathcal{Q}({\bf x}|\boldsymbol{v},{\bf d})$ and the true distribution $\mathcal{P}({\bf x}|\boldsymbol{v},{\bf d})$.
This moves the distributions of the weights around rather than the weights themselves
Really helps with optimisation and gives distributions as outputs!
Very limiting on the form of the final distribution $\mathcal{Q}({\bf x}|\boldsymbol{v},{\bf d})$ which will never really become $\mathcal{P}({\bf x}|\boldsymbol{v},{\bf d})$
Instead of forcing the form of the weights, we should really sample them
$$\mathcal{P}(\boldsymbol{v}|{\bf x},{\bf d}) \propto \mathcal{L}({\bf x}|\boldsymbol{v},{\bf d})p(\boldsymbol{v}|{\bf d})$$Real outputs are available by marginalising the weights out
Many techniques for sampling, such as Markov chain Monte-Carlo
In practise the number of weights is too high dimensional to do this
It is possible to sample the weights of your network in high dimensions using HMC!
(it is still quite expensive)



It's super useful everywhere - especially in astrophysics
It's a statisticians best friend
You can do loads of cool things
You should never trust it
But you should also find ways to trust it because it's so useful