code: def get_ranks(self, predictions):
      # Get the raw uncertainty from the base heuristic.
      scores = self.get_scores(predictions)
      # Create the distribution to sample from.
      distributions = self._make_distribution(scores)
      # Force normalization for np.random.choice
      distributions = np.clip(distributions, 0, None)
      distributions /= distributions.sum()
  
      # TODO Seed?
      if (distributions > 0).sum() < self.query_size:
          log.warnings("Not enough values, return random")
          distributions = np.ones_like(distributions) / len(
              distributions
          )
      return (
          np.random.choice(
              len(distributions),
              self.query_size,
              replace=False,
              p=distributions,
          ),
          distributions,
      )
  
imports: import types
  import numpy
  import structlog
  from scipy.special import softmax
  from scipy.stats import rankdata
  from baal.active.heuristics import AbstractHeuristic, Sequence
label_desc: Use image node_id 2 for calling the StochasticHeuristic obj's underlying member method code with example usage: obj.get_ranks(predictions) and returns: np,  distributions