docstr: Samples from the ranks of the uncertainty distribution.
  
  References:
      Stochastic Batch Acquisition for Deep Active Learning, Kirsch et al. (2022)
      https://arxiv.org/abs/2106.12059
  
  Args:
      base_heuristic: Heuristic to get uncertainty from before sampling.
      query_size: These heuristics will return `query_size` items.
      temperature: Value to temper the uncertainty distribution before sampling.
docstr_tok: ["Samples","from","the","ranks","of","the","uncertainty","distribution",".","References",":","Stochastic","Batch","Acquisition","for","Deep","Active","Learning",",","Kirsch","et","al",".","(","2022",")","https",":","\/\/arxiv.org\/abs\/2106.12059","Args",":","base_heuristic",":","Heuristic","to","get","uncertainty","from","before","sampling",".","query_size",":","These","heuristics","will","return","`","query_size","`","items",".","temperature",":","Value","to","temper","the","uncertainty","distribution","before","sampling","."]
code: def __init__(
      self,
      base_heuristic: AbstractHeuristic,
      query_size,
      temperature=1.0,
  ):
      """Samples from the ranks of the uncertainty distribution.
  
      References:
          Stochastic Batch Acquisition for Deep Active Learning, Kirsch et al. (2022)
          https://arxiv.org/abs/2106.12059
  
      Args:
          base_heuristic: Heuristic to get uncertainty from before sampling.
          query_size: These heuristics will return `query_size` items.
          temperature: Value to temper the uncertainty distribution before sampling.
      """
      super().__init__(
          base_heuristic=base_heuristic, query_size=query_size
      )
      self.temperature = temperature
  
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 1 to create a new RankBasedSampling object from inherited base classes: StochasticHeuristic with example: obj = RankBasedSampling(base_heuristic, query_size, temperature)