class_docstr: Results from computing metrics.
class_docstr_tok: ["Results","from","computing","metrics","."]
docstr: Return an instance of these metrics from a given set of true and scores.
docstr_tok: ["Return","an","instance","of","these","metrics","from","a","given","set","of","true","and","scores","."]
code: def from_scores(
      cls,
      metrics: Iterable[ClassificationMetric],
      scores_and_true_masks: Iterable[ScorePack],
  ):
      """Return an instance of these metrics from a given set of true and scores."""
      return cls(
          data={
              ClassificationMetricKey(
                  side=pack.target, metric=metric.key
              ): metric(pack.y_true, pack.y_score)
              for metric, pack in itertools.product(
                  metrics, scores_and_true_masks
              )
          }
      )
  
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 ClassificationMetricResults obj's underlying member method code with example usage: obj.from_scores(cls, metrics, scores_and_true_masks) and returns: cls