class_docstr: Population-Based Training, also known as Lamarckism or Meta-Optimization.
code: def _func(self, x: np.ndarray):
      assert len(x) == self._hyperparameter_dimension
  
      # First, let us find the checkpoint that we want to use.
      if np.random.uniform() > 0.666:
          distances = self._population_fitness
      else:
          if np.random.uniform() > 0.5:
              distances = [np.linalg.norm(i - x, 0) for i in self._population_parameters]  # type: ignore
          else:
              distances = [np.linalg.norm(i - x, 1) for i in self._population_parameters]  # type: ignore
      _, source_idx = min(
          (val, idx) for (idx, val) in enumerate(distances)
      )
  
      # Let us copy the checkpoint to a target.
      idx = np.random.choice(range(len(self._population_fitness)))
      if idx != source_idx:
          self._population_checkpoints[
              idx
          ] = self._population_checkpoints[source_idx].copy()
          self._population_fitness[idx] = self._population_fitness[
              source_idx
          ]
      self._population_parameters[idx] = x
  
      # Here the case-specific learning and evaluation.
      self.evolve(
          self._population_checkpoints[idx],
          self._population_parameters[idx],
      )
      self._population_fitness[idx] = self.value(
          self._population_checkpoints[idx]
      )
  
      return self._population_fitness[idx]
  
file_path: nevergrad/nevergrad/functions/pbt.py
imports: import itertools
  import typing
  import numpy
  from nevergrad.parametrization import parameter
  from .base import ExperimentFunction
  from .None import corefuncs
label_desc: Use image node_id 5 for calling the PBT obj's underlying member method code with example usage: obj._func(x) and returns: self