Class CyclicalTracker.Builder

java.lang.Object
ai.djl.training.tracker.CyclicalTracker.Builder
Enclosing class:
CyclicalTracker

public static final class CyclicalTracker.Builder extends Object
The Builder to construct an CyclicalTracker object.
  • Method Details

    • optBaseValue

      public CyclicalTracker.Builder optBaseValue(float baseValue)
      Sets the initial value. Default: 0.001.
      Parameters:
      baseValue - the initial value
      Returns:
      this Builder
    • optMaxValue

      public CyclicalTracker.Builder optMaxValue(float maxValue)
      Sets the initial value. Default: 0.006.
      Parameters:
      maxValue - the max value
      Returns:
      this Builder
    • optStepSizeUp

      public CyclicalTracker.Builder optStepSizeUp(int stepSizeUp)
      Sets the number of iterations in up half of cycle. Default: 2000.
      Parameters:
      stepSizeUp - number of iterations in up half of cycle
      Returns:
      this Builder
    • optStepSizeDown

      public CyclicalTracker.Builder optStepSizeDown(int stepSizeDown)
      Sets the number of iterations in up half of cycle. If stepSizeDown equals 0, it is set to stepSizeUp. Default: 0.
      Parameters:
      stepSizeDown - number of iterations in the down half of cycle
      Returns:
      this Builder
    • optMode

      Sets the cyclical mode. Can be CyclicalMode.TRIANGULAR, CyclicalMode.TRIANGULAR2 or CyclicalMode.EXP_RANGE. Values correspond to policies detailed above.
      Parameters:
      mode - cyclical mode
      Returns:
      this Builder
    • optGamma

      public CyclicalTracker.Builder optGamma(float gamma)
      Constant in CyclicalMode.EXP_RANGE scaling function. Default: 1.
      Parameters:
      gamma - constant in 'exp_range' scaling function: gamma^cycleIterations
      Returns:
      this Builder
    • optScaleFunction

      public CyclicalTracker.Builder optScaleFunction(CyclicalTracker.ScaleFunction scaleFunction)
      Custom scaling function. If set, mode will be ignored. Default: null.
      Parameters:
      scaleFunction - Custom scaling function
      Returns:
      this Builder
    • optScaleModeCycle

      public CyclicalTracker.Builder optScaleModeCycle(boolean scaleModeCycle)
      Defines whether scaling function is evaluated on cycle number or update number. Default: true.
      Parameters:
      scaleModeCycle - if true then scaling function is evaluated on cycle number, else on update number
      Returns:
      this Builder
    • build

      public CyclicalTracker build()
      Builds a CyclicalTracker block.
      Returns:
      the CyclicalTracker block