# Problem with Proposition 1 of Google Deepmind's 'Weight uncertainty in Neural Networks'

I'm going through the paper Weight Uncertainty in Neural Networks by Google Deepmind. In the final line of the proof of proposition 1, the integral and the derivative are swapped. Then the derivative is taken. But this somehow yields 2 derivatives of $$f$$ with respect to $$\theta$$. I thought that this was the result of a product rule applied to $$q(\epsilon)$$ and $$f(w,\theta)$$ and then the chain rule. But that does not yield the same outcome as $$\frac{\partial q(\epsilon)}{\partial \theta} = 0$$. My question is: does anyone understand how the equation in the last line comes about?

$$\frac{\partial}{\partial \theta} \mathbb E_{q(\mathbf w\mid\theta)}[f(\mathbf w, \theta)]$$

using definition of expectation for continuous case:

$$\mathbb E[X] = \int xp(x) dx$$

for the first equation we get:

$$\frac{\partial}{\partial \theta} \int f(\mathbf w, \theta)q(\mathbf w \mid \theta) d\mathbf w$$

we swap $$q(\mathbf w \mid \theta) d\mathbf w$$ for $$q(\epsilon)d\epsilon$$ and we get:

$$\frac{\partial}{\partial \theta} \int f(\mathbf w, \theta)q(\epsilon)d\epsilon$$

using definition of expectation again we have:

$$\frac{\partial}{\partial \theta} \mathbb E_{q(\epsilon)}[f(\mathbf w,\theta)]$$

i believe dominant convergence theorem let's us interchange expectation and derivative and we have:

$$\mathbb E_{q(\epsilon)}[\frac{\partial}{\partial \theta}f(\mathbf w,\theta)]$$

we have a function $$f$$ that depends on two variables $$\mathbf w$$ and $$\theta$$. In order to get a full derivative of such function we need to take derivative of $$f$$ with respect to both variables. We have:

$$\mathbb E_{q(\epsilon)}[\frac{\partial f(\mathbf w,\theta)}{\partial \theta} + \frac{\partial f(\mathbf w,\theta)}{\partial \mathbf w} \frac{\partial \mathbf w}{\partial \theta}]$$

First term inside expectation is derivative of function $$f$$ with respect to $$\theta$$ directly, and in the second term $$f$$ is derivated with respect to $$\mathbf w$$, but we need to apply chain rule to get full derivative with respect to $$\theta$$

• The great mathematician Gauss would be proud of this answer. The differential equation was interpreted right, and the transformation is correct. The markup language here in the forum was used perfect and it has to do with a problem for modern Artificial Intelligence. – Manuel Rodriguez Feb 22 '19 at 13:03
• Thank you for your answer. This solves it. I stared at this for a while but did not take into account that $\textbf{w}$ is a function of $\theta$. – TimvanSch Feb 22 '19 at 13:52