code: def _bald_divergence(proba: list) -> np.ndarray:
      """
      Calculates the bald divergence for each instance
  
      As it is explicitly formulated in:
          Deep Bayesian Active Learning with Image Data.
          (Yarin Gal, Riashat Islam, and Zoubin Ghahramani. 2017.)
  
      Args:
          proba: list with the predictions over the dropout cycles
          mask: mask to detect the padded classes (must be of same shape as elements in proba)
      Return:
          Returns the mean standard deviation of the dropout cycles over all classes.
      """
      proba_stacked = np.stack(proba, axis=len(proba[0].shape))
  
      # entropy along dropout cycles
      accumulated_entropy = entropy_sum(proba_stacked, axis=-1)
      f_x = accumulated_entropy / len(proba)
  
      # score sums along dropout cycles
      accumulated_score = np.sum(proba_stacked, axis=-1)
      average_score = accumulated_score / len(proba)
      # expand dimension w/o data for entropy calculation
      average_score = np.expand_dims(average_score, axis=-1)
  
      # entropy over average prediction score
      g_x = entropy_sum(average_score, axis=-1)
  
      # entropy differences
      diff = np.subtract(g_x, f_x)
  
      # sum all dimensions of diff besides first dim (instances)
      shaped = np.reshape(diff, (diff.shape[0], -1))
  
      bald = np.sum(shaped, where=~np.isnan(shaped), axis=-1)
      return bald
  
imports: from collections.abc import Mapping
  from typing import Callable
  import numpy
  import torch
  from scipy.special import entr
  from sklearn.base import BaseEstimator
  from skorch.utils import to_numpy
  from modAL.utils.data import modALinput
  from modAL.utils.selection import multi_argmax, shuffled_argmax
label_desc: Use image node_id 11 for calling a global function with example usage: _bald_divergence(proba) and returns: bald