ai4med.components.lr_policies package

class DecayOnStep(decay_ratio: float, decay_freq: int)

Bases: ai4med.components.lr_policies.lr_policy.LRPolicy

Reduce learning rate based on configured ratio and step frequency.

Parameters
  • decay_ratio (float) – ratio of LR adjustment

  • decay_freq (int) – adjustment frequency in number of training steps

evaluate(train_ctx: ai4med.common.train_ctx.TrainContext)

Compute the new LR.

The LR is adjusted to current_lr * ratio every decay_freq number of steps.

Parameters

train_ctx – training context

Returns: new LR value

class LRPolicy

Bases: abc.ABC

Defines the interface for Learning Rate (LR) Policy components

abstract evaluate(train_ctx: ai4med.common.train_ctx.TrainContext)

Compute the new learning rate based on information in train_ctx. This is the required method that a LRPolicy subclass must implement.

Parameters

train_ctx – training contextual data

Returns: a new learning rate

class ReduceCosine(rate=0.5)

Bases: ai4med.components.lr_policies.lr_policy.LRPolicy

This LR policy reduces the LR based on initial LR, current epoch and total number of epochs.

Parameters

rate (float) – rate of reduction (Default: 0.5)

evaluate(train_ctx: ai4med.common.train_ctx.TrainContext)

Computes the new LR value.

Implemented with the ai4med.libs.lr_policies.cos_reducer.CosineReducer.reduce()

Parameters

train_ctx – training context

Returns: new LR value

class ReduceOnPlateau(plateau_count_trigger: int, reduction_rate: float)

Bases: ai4med.components.lr_policies.lr_policy.LRPolicy

Reduce LR when validation metric stops improving.

Parameters
  • plateau_count_trigger (int) – length of non-improving period

  • reduction_rate (float) – rate of LR reduction

evaluate(train_ctx: ai4med.common.train_ctx.TrainContext)

Computes the new LR value.

Implemented with the ‘reduce’ method defined in the OnPlateauReducer class.

Parameters

train_ctx – training context

Returns: new LR value

class ReducePoly(poly_power)

Bases: ai4med.components.lr_policies.lr_policy.LRPolicy

evaluate(train_ctx: ai4med.common.train_ctx.TrainContext)

Compute the new learning rate based on information in train_ctx. This is the required method that a LRPolicy subclass must implement.

Parameters

train_ctx – training contextual data

Returns: a new learning rate

© Copyright 2020, NVIDIA. Last updated on Feb 2, 2023.