class_docstr: A test case for quickly defining common tests for samplers.
class_docstr_tok: ["A","test","case","for","quickly","defining","common","tests","for","samplers","."]
docstr: Set up the test case with a triples factory, training instances, and a default positive batch.
docstr_tok: ["Set","up","the","test","case","with","a","triples","factory",",","training","instances",",","and","a","default","positive","batch","."]
code: def pre_setup_hook(self) -> None:
      """Set up the test case with a triples factory, training instances, and a default positive batch."""
      self.triples_factory = Nations().training
      self.training_instances = (
          self.triples_factory.create_slcwa_instances()
      )
      random_state = numpy.random.RandomState(seed=self.seed)
      batch_indices = random_state.randint(
          low=0,
          high=len(self.training_instances),
          size=(self.batch_size,),
      )
      self.positive_batch = self.training_instances.mapped_triples[
          batch_indices
      ]
  
file_path: pykeen/tests/test_sampling/cases.py
imports: from typing import Any, MutableMapping
  import numpy
  import torch
  import unittest_templates
  from pykeen.datasets import Nations
  from pykeen.sampling import NegativeSampler
  from pykeen.sampling.filtering import BloomFilterer, PythonSetFilterer
  from pykeen.triples import Instances, TriplesFactory
label_desc: Use image node_id 1 for calling the NegativeSamplerGenericTestCase obj's underlying member method code with example usage: obj.pre_setup_hook() without return types