Class BaseHpOptimizer

java.lang.Object
ai.djl.training.hyperparameter.optimizer.BaseHpOptimizer
All Implemented Interfaces:
HpOptimizer
Direct Known Subclasses:
HpORandom

public abstract class BaseHpOptimizer extends Object implements HpOptimizer
A base containing shared implementations for HpOptimizers.
See Also:
  • Field Details

  • Constructor Details

    • BaseHpOptimizer

      public BaseHpOptimizer(HpSet hyperParams)
      Constructs a BaseHpOptimizer.
      Parameters:
      hyperParams - the set of hyperparameters
  • Method Details

    • update

      public void update(HpSet config, float loss)
      Updates the optimizer with the results of a hyperparameter test.
      Specified by:
      update in interface HpOptimizer
      Parameters:
      config - the tested hyperparameters
      loss - the validation loss from training with those hyperparameters
    • getLoss

      public float getLoss(HpSet config)
      Returns the recorded loss.
      Specified by:
      getLoss in interface HpOptimizer
      Parameters:
      config - the hyperparameters that were trained with
      Returns:
      the loss
    • getBest

      public ai.djl.util.Pair<HpSet,Float> getBest()
      Returns the best hyperparameters and loss.
      Specified by:
      getBest in interface HpOptimizer
      Returns:
      the best hyperparameters and loss