Package ai.djl.training.tracker
Class CyclicalTracker.Builder
- java.lang.Object
-
- ai.djl.training.tracker.CyclicalTracker.Builder
-
- Enclosing class:
- CyclicalTracker
public static final class CyclicalTracker.Builder extends java.lang.ObjectThe Builder to construct anCyclicalTrackerobject.
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description CyclicalTrackerbuild()Builds aCyclicalTrackerblock.CyclicalTracker.BuilderoptBaseValue(float baseValue)Sets the initial value.CyclicalTracker.BuilderoptGamma(float gamma)Constant inCyclicalMode.EXP_RANGEscaling function.CyclicalTracker.BuilderoptMaxValue(float maxValue)Sets the initial value.CyclicalTracker.BuilderoptMode(CyclicalTracker.CyclicalMode mode)Sets the cyclical mode.CyclicalTracker.BuilderoptScaleFunction(CyclicalTracker.ScaleFunction scaleFunction)Custom scaling function.CyclicalTracker.BuilderoptScaleModeCycle(boolean scaleModeCycle)Defines whether scaling function is evaluated on cycle number or update number.CyclicalTracker.BuilderoptStepSizeDown(int stepSizeDown)Sets the number of iterations in up half of cycle.CyclicalTracker.BuilderoptStepSizeUp(int stepSizeUp)Sets the number of iterations in up half of cycle.
-
-
-
Method Detail
-
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. IfstepSizeDownequals 0, it is set tostepSizeUp. Default: 0.- Parameters:
stepSizeDown- number of iterations in the down half of cycle- Returns:
- this
Builder
-
optMode
public CyclicalTracker.Builder optMode(CyclicalTracker.CyclicalMode mode)
Sets the cyclical mode. Can beCyclicalMode.TRIANGULAR,CyclicalMode.TRIANGULAR2orCyclicalMode.EXP_RANGE. Values correspond to policies detailed above.- Parameters:
mode- cyclical mode- Returns:
- this
Builder
-
optGamma
public CyclicalTracker.Builder optGamma(float gamma)
Constant inCyclicalMode.EXP_RANGEscaling 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,modewill 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 aCyclicalTrackerblock.- Returns:
- the
CyclicalTrackerblock
-
-