class_docstr: An evaluator that uses a classification metrics.
class_docstr_tok: ["An","evaluator","that","uses","a","classification","metrics","."]
code: def process_scores_(
      self,
      hrt_batch: MappedTriples,
      target: Target,
      scores: torch.FloatTensor,
      true_scores: Optional[torch.FloatTensor] = None,
      dense_positive_mask: Optional[torch.FloatTensor] = None,
  ) -> None:  # noqa: D102
      if dense_positive_mask is None:
          raise KeyError("Sklearn evaluators need the positive mask!")
  
      # Transfer to cpu and convert to numpy
      scores = scores.detach().cpu().numpy()
      dense_positive_mask = dense_positive_mask.detach().cpu().numpy()
      remaining = [
          i
          for i in range(hrt_batch.shape[1])
          if i != TARGET_TO_INDEX[target]
      ]
      keys = hrt_batch[:, remaining].detach().cpu().numpy()
  
      # Ensure that each key gets counted only once
      for i in range(keys.shape[0]):
          key = tuple(map(int, keys[i]))
          assert len(key) == 2
          key = cast(Tuple[int, int], key)
          self.all_scores[target][key] = scores[i]
          self.all_positives[target][key] = dense_positive_mask[i]
  
imports: from __future__ import annotations
  import itertools
  from collections import defaultdict
  from typing import Iterable, Mapping, MutableMapping, NamedTuple, Optional, Tuple, cast
  import numpy
  import numpy
  import torch
  from .evaluator import Evaluator, MetricResults
  from ..constants import TARGET_TO_INDEX
  from ..metrics.classification import ClassificationMetric, classification_metric_resolver
  from ..typing import SIDE_BOTH, ExtendedTarget, MappedTriples, Target, normalize_target
label_desc: Use image node_id 2 for calling the ClassificationEvaluator obj's underlying member method code with example usage: obj.process_scores_(hrt_batch, target, scores, true_scores, dense_positive_mask) without return types