Monte Carlo Dropout

Description

Monte Carlo dropout estimates how uncertain a neural network is about each prediction. Dropout randomly switches off some of the network's units and is normally used only in training, but here it stays on at prediction time. Each forward pass (one run of an input through the network) therefore uses a different random pattern of units, and the input is run through typically tens to a hundred times. The average gives the prediction, and the spread across runs is read as epistemic uncertainty, meaning uncertainty from the model's limited knowledge rather than noise in the data. The method approximates Bayesian inference, but the spread is an estimate whose reliability should be checked against held-out errors.

Example Use Cases

Reliability

Quantifying diagnostic uncertainty in medical imaging models by running 50+ Monte Carlo forward passes to detect when a chest X-ray classification is highly uncertain, prompting radiologist review for borderline cases.

An autonomous-driving team replays recorded camera footage through its object detector with dropout left on, and finds the scenes (night rain, unusual vehicles) where detections vary most between passes. It uses them to decide what data to collect and which scenarios to add to simulation testing.

A grid operator's demand-forecasting network, trained with dropout, is run 100 times each morning. Days on which the forecasts spread beyond the planners' tolerance are sent for human review before reserve capacity is booked.

Limitations

  • The spread across passes reflects uncertainty about the model's parameters, not noise in the data that varies from input to input. An input in a very noisy region can still show a narrow spread, so a narrow spread does not mean the outcome is predictable.
  • Each prediction needs many forward passes, typically 50 to 100, so inference costs that many times more compute, and too few passes make the spread itself unstable. The passes can run in parallel, which limits added delay but not total compute, so real-time or edge deployments with tight budgets may not afford it.
  • The network must have been trained with dropout, and the derivation assumes it sits before every weight layer. A model trained without dropout has to be retrained, so the technique is often unavailable for models already built or bought in.
  • The size of the spread depends on the dropout probability and weight decay, which the developer sets or tunes on validation data rather than learns from the data. The uncertainty scale is partly a design choice and needs checking against held-out errors.
  • The spread is an approximation, and its behaviour depends on the architecture. In the original paper's regression experiments, uncertainty kept growing away from the training data with ReLU activations but stayed bounded with TanH, so a narrow spread on unfamiliar inputs is not proof of familiarity.

Resources

Research Papers

Dropout as a Bayesian Approximation: Representing Model Uncertainty in Deep Learning
Yarin Gal and Zoubin Ghahramani•Jun 6, 2015

Deep learning tools have gained tremendous attention in applied machine learning. However such tools for regression and classification do not capture model uncertainty. In comparison, Bayesian models offer a mathematically grounded framework to reason about model uncertainty, but usually come with a prohibitive computational cost. In this paper we develop a new theoretical framework casting dropout training in deep neural networks (NNs) as approximate Bayesian inference in deep Gaussian processes. A direct result of this theory gives us tools to model uncertainty with dropout NNs -- extracting information from existing models that has been thrown away so far. This mitigates the problem of representing uncertainty in deep learning without sacrificing either computational complexity or test accuracy. We perform an extensive study of the properties of dropout's uncertainty. Various network architectures and non-linearities are assessed on tasks of regression and classification, using MNIST as an example. We show a considerable improvement in predictive log-likelihood and RMSE compared to existing state-of-the-art methods, and finish by using dropout's uncertainty in deep reinforcement learning.

Software Packages

torch-uncertainty

Open-source framework for uncertainty and deep learning models in PyTorch 🌱 - torch-uncertainty/torch-uncertainty

Tutorials

Training a LeNet with Monte Carlo dropout - TorchUncertainty Docs

Documentations

mc_dropout - TorchUncertainty Docs

Tags

Reliability Dimensions