# Reparameterization trick

*05 September 2016*

Consider a -valued random variable and a -valued random variable , both defined on a common probability space . Let be a measurable function (i.e. for all , the pre-image ). Let be a measurable function such that (i.e. ). Hence we have, by definition,
\begin{align}
\E[f(X)] := \int_{\Omega} f(X(\omega)) \mathbb P(\mathrm d \omega)
= \int_{\Omega} f(g(Y(\omega))) \mathbb P(\mathrm d \omega)
=: \E[f(g(Y))]. \label{eq:reparam/exp}
\end{align}
Let be the probability distributions of . We have two Monte Carlo estimators of the same quantity in \eqref{eq:reparam/exp}:
\begin{align}
\E[f(X)] &\approx I_X^{MC} := \frac{1}{N} \sum_{i = 1}^N f(X^i), && X^i \sim P_X, i = 1, \dotsc, N \\
\E[f(g(Y))] &\approx I_Y^{MC} := \frac{1}{N} \sum_{i = 1}^N f \circ g (Y^i), && Y^i \sim P_Y, i = 1, \dotsc, N.
\end{align}

## Why is it useful

Let the distribution be parameterized by . We canâ€™t evaluate . However, if is not parameterized by and is parameterized by such that then we can find .

This is often used in variational autoencoders (missing reference) discussed here.

**References**

[back]