class_docstr: Tests for early stopping during training.
class_docstr_tok: ["Tests","for","early","stopping","during","training","."]
docstr: Test if the best epoch model is returned when using the early stopper.
docstr_tok: ["Test","if","the","best","epoch","model","is","returned","when","using","the","early","stopper","."]
code: def test_early_stopper_best_epoch_model_retrieval(self):
      """Test if the best epoch model is returned when using the early stopper."""
      training_loop = DummyTrainingLoop(
          model=self.model,
          triples_factory=self.triples_factory.training,
          sub_batch_size=self.batch_size,
      )
  
      _ = training_loop.train(
          triples_factory=self.triples_factory.training,
          num_epochs=10,
          batch_size=self.batch_size,
          stopper=self.stopper,
          use_tqdm=False,
      )
      self.assertEqual(training_loop._epoch, self.stop_constant + 1)
  
file_path: pykeen/tests/test_training/test_stopping.py
imports: import unittest
  from typing import List, Optional
  import torch
  from torch import optim
  from pykeen.datasets import Nations
  from pykeen.models import FixedModel, Model
  from pykeen.stoppers.early_stopping import EarlyStopper
  from pykeen.training import SLCWATrainingLoop
  from pykeen.triples import TriplesFactory
  from pykeen.typing import MappedTriples
  from tests.mocks import MockEvaluator
label_desc: Use image node_id 2 for calling the TestTrainingEarlyStopping obj's underlying member method code with example usage: obj.test_early_stopper_best_epoch_model_retrieval() without return types