class_docstr: A mock evaluator for testing early stopping.
class_docstr_tok: ["A","mock","evaluator","for","testing","early","stopping","."]
code: def finalize(self) -> MetricResults:  # noqa: D102
      result = RankBasedMetricResults.create_random(self.random_state)
      assert self.values_iter is not None
      if self.key not in result.data:
          raise KeyError(self.key)
      result.data[self.key] = next(self.values_iter)
      return result
  
file_path: pykeen/tests/mocks.py
imports: from typing import Iterable, Optional, Tuple
  import torch
  from torch import nn
  from pykeen.evaluation import Evaluator, MetricResults, RankBasedMetricResults
  from pykeen.nn import Representation
  from pykeen.typing import ExtendedTarget, MappedTriples, RankType, Target
label_desc: Use image node_id 4 for calling the MockEvaluator obj's underlying member method code with example usage: obj.finalize() and returns: result