  In Hezaveh et al. 2017 we showed that deep learning can be used for model
parameter estimation and trained convolutional neural networks to determine the
parameters of strong gravitational lensing systems. Here we demonstrate a
method for obtaining the uncertainties of these parameters. We review the
framework of variational inference to obtain approximate posteriors of Bayesian
neural networks and apply it to a network trained to estimate the parameters of
the Singular Isothermal Ellipsoid plus external shear and total flux
magnification. We show that the method can capture the uncertainties due to
different levels of noise in the input data, as well as training and
architecture-related errors made by the network. To evaluate the accuracy of
the resulting uncertainties, we calculate the coverage probabilities of
marginalized distributions for each lensing parameter. By tuning a single
hyperparameter, the dropout rate, we obtain coverage probabilities
approximately equal to the confidence levels for which they were calculated,
resulting in accurate and precise uncertainty estimates. Our results suggest
that neural networks can be a fast alternative to Monte Carlo Markov Chains for
parameter uncertainty estimation in many practical applications, allowing more
than seven orders of magnitude improvement in speed.
