class_docstr: Epistemic as active learning strategy
code: def __call__(self, request, datastore: Datastore):
      label_tag = request.get("label_tag")
      labels = request.get("labels")
      images = datastore.get_unlabeled_images(label_tag, labels)
  
      if not len(images):
          return None
  
      scores: Dict[str, Any] = {}
      current_ts = int(time.time())
      strategy = request["strategy"]
  
      for image in images:
          info = datastore.get_image_info(image)
          score = info.get(self.key, 0)
          ts = min(
              current_ts
              - info.get("strategy", {}).get(strategy, {}).get("ts", 0),
              self.reset,
          )
          scores[image] = {"score": score, "ts": ts}
  
      scores = {k: v for k, v in sorted(scores.items(), key=lambda item: item[1]["score"], reverse=True)}  # type: ignore
      logger.info(f"{strategy}: Top-N: {scores}")
  
      # Pick Top-N based on epistemic scores
      top_k: Dict[str, Any] = {}
      max_len = self.k if 0 < self.k < len(scores) else len(scores)
      for k, v in scores.items():
          if len(top_k) == max_len:
              break
          # Handle similar timestamps
          top_k[k] = {
              "score": v["score"],
              "ts": v["ts"]
              - (
                  pow(10, len(top_k))
                  if v["ts"] == self.reset
                  else len(top_k)
              )
              * 10,
          }
      logger.info(f"{strategy}: Top-K: {top_k}")
  
      # Pick the one which is least served recently among Top-N
      top_k = {k: v for k, v in sorted(scores.items(), key=lambda item: item[1]["ts"], reverse=True)}  # type: ignore
      logger.info(f"{strategy}: Top-K (ts): {top_k};")
  
      image = next(iter(top_k))
      logger.info(
          f"{strategy}: Selected Image: {image}; epistemic_entropy: {top_k[image]}"
      )
      return {"id": image, "epistemic_entropy": top_k[image]}
  
file_path: MONAILabel/monailabel/tasks/activelearning/epistemic.py
imports: import logging
  import time
  from typing import Any, Dict
  from monailabel.interfaces.datastore import Datastore
  from monailabel.interfaces.tasks.strategy import Strategy
label_desc: Use image node_id 2 for calling the Epistemic obj's underlying member method code with example usage: obj.__call__(request, datastore) and returns: dict, None