Uncertainty and Explainability

Related: 8. Convolutional Neural Networks | 4. Deep Learning and FCNs | 6. Loss Functions and Backpropagation | 7. Evaluating ML Models | Artificial Intelligence


Monte Carlo Dropout for Uncertainty

Deep learning models are typically “black boxes” — they give predictions but no confidence measure. Dropout was originally introduced as a regularisation technique, but it can also be used for uncertainty estimation.

MC Dropout method:

  1. Train the model with dropout as usual
  2. At inference, keep dropout active (don’t disable it)
  3. Run multiple forward passes on the same input → different predictions each time
  4. Average the predictions → final output
  5. Standard deviation of the predictions → uncertainty estimate

High std = model is uncertain; Low std = model is confident.

Explainable AI (XAI)

XAI aims to make AI decisions interpretable and understandable to humans. This is especially important for evaluating model reliability beyond standard metrics (see 7. Evaluating ML Models).

Grad-CAM (Gradient-weighted Class Activation Mapping)

Provides visual explanations for CNN decisions by highlighting important image regions.

How it works:

  1. Take the feature maps from the last convolutional layer
  2. Compute the gradient of the predicted class with respect to each feature map
  3. Compute a weighted sum of feature maps using these gradients → produces a 2D heatmap
  4. Upsample the heatmap to match the original image size
  5. Overlay the heatmap on the original image

The result shows which regions contributed most to the prediction — warm colours indicate high importance.