class_docstr: Implementation of BatchBALD from https://github.com/BlackHC/BatchBALD
  
  Args:
      num_samples (int): Number of samples to select (also called query_size).
      num_draw (int): Number of draw to perform from the history.
                      From the paper `40000 // num_classes` is suggested.
      shuffle_prop (float): Amount of noise to put in the ranking. Helps with selection bias
          (default: 0.0).
      reduction (Union[str, callable]): function that aggregates the results
          (default: 'none').
  
  Notes:
      This implementation returns the scores
       which is not necessarily ordered in the same way as they were selected.
  
  References:
      https://arxiv.org/abs/1906.08158
  
  Notes:
      K = iterations, C=classes
      Not tested on 4+ dims.
class_docstr_tok: ["Implementation","of","BatchBALD","from","https",":","\/\/github.com\/BlackHC\/BatchBALD","Args",":","num_samples","(","int",")",":","Number","of","samples","to","select","(","also","called","query_size",")",".","num_draw","(","int",")",":","Number","of","draw","to","perform","from","the","history",".","From","the","paper","`","40000","\/\/","num_classes","`","is","suggested",".","shuffle_prop","(","float",")",":","Amount","of","noise","to","put","in","the","ranking",".","Helps","with","selection","bias","(","default",":","0.0",")",".","reduction","(","Union","[","str",",","callable","]",")",":","function","that","aggregates","the","results","(","default",":","'none","'",")",".","Notes",":","This","implementation","returns","the","scores","which","is","not","necessarily","ordered","in","the","same","way","as","they","were","selected",".","References",":","https",":","\/\/arxiv.org\/abs\/1906.08158","Notes",":","K","=","iterations",",","C=classes","Not","tested","on","4+","dims","."]
docstr: Compute the score according to the heuristic.
  
  Args:
      predictions (ndarray): Array of predictions [batch_size, C, Iterations]
  
  Notes:
      Only Classification is supported, not semantic segmentation or other.
  
  Returns:
      Array of scores.
docstr_tok: ["Compute","the","score","according","to","the","heuristic",".","Args",":","predictions","(","ndarray",")",":","Array","of","predictions","[","batch_size",",","C",",","Iterations","]","Notes",":","Only","Classification","is","supported",",","not","semantic","segmentation","or","other",".","Returns",":","Array","of","scores","."]
code: def compute_score(self, predictions):
      """
      Compute the score according to the heuristic.
  
      Args:
          predictions (ndarray): Array of predictions [batch_size, C, Iterations]
  
      Notes:
          Only Classification is supported, not semantic segmentation or other.
  
      Returns:
          Array of scores.
      """
      MIN_SPREAD = 0.1
      COUNT = 0
      # Get conditional_entropies_B
      conditional_entropies_B = self._conditional_entropy(predictions)
      bald_out = super().compute_score(predictions)
      # We start with the most uncertain sample according to BALD.
      bald_out = self.reduction(bald_out)
      history = bald_out.argsort()[-1:].tolist()
      uncertainties = np.zeros_like(bald_out)
      uncertainties[history[0]] = bald_out.max()
      for step in range(self.num_samples):
          # Draw `num_draw` example from history, take entropy
          # TODO use numpy/numba
          selected = self._sample_from_history(
              predictions[history], num_draw=self.num_draw
          )
  
          # Compute join entropy
          joint_entropy = list(
              self._joint_entropy(predictions, selected)
          )
          joint_entropy = np.concatenate(joint_entropy)
  
          partial_multi_bald_b = joint_entropy - conditional_entropies_B
          partial_multi_bald_b = self.reduction(partial_multi_bald_b)
          partial_multi_bald_b[..., np.array(history)] = -1000
          # Add best to history
          partial_multi_bald_b = partial_multi_bald_b.squeeze()
          assert partial_multi_bald_b.ndim == 1
          winner_index = partial_multi_bald_b.argmax()
          history.append(winner_index)
          uncertainties[winner_index] = partial_multi_bald_b.max()
  
          if partial_multi_bald_b.max() < MIN_SPREAD:
              COUNT += 1
              if COUNT > 10 or len(history) >= self.num_samples:
                  break
  
      return uncertainties
  
imports: import types
  import warnings
  from collections.abc import Sequence
  from functools import wraps
  from typing import List
  import numpy
  import scipy.stats
  import torch
  from scipy.special import xlogy
  from torch import Tensor
  from baal.utils.array_utils import to_prob
label_desc: Use image node_id 6 for calling the BatchBALD obj's underlying member method code with example usage: obj.compute_score(predictions) and returns: uncertainties