clinicadl.optim.lr_schedulers.config.ReduceLROnPlateauConfig

clinicadl.optim.lr_schedulers.config.ReduceLROnPlateauConfig[source]

Config class for torch.optim.lr_scheduler.ReduceLROnPlateau.

min_lr accepts a dictionary in case you defined several parameter groups in your optimizer configuration class. Use the same group names as the ones passed to the optimizer to specify different values for each group.

Examples

from clinicadl.networks.nn import CNN

network = CNN(
    in_shape=(1, 16, 16, 16),
    num_outputs=1,
    conv_args={"channels": [2, 4]},
)
>>> network
CNN(
    (convolutions): ConvEncoder(
        (layer0): Convolution(
            (conv): Conv3d(1, 2, kernel_size=(3, 3, 3), stride=(1, 1, 1))
        )
    )
    (mlp): MLP(
        (flatten): Flatten(start_dim=1, end_dim=-1)
        (output): Sequential(
            (linear): Linear(in_features=5488, out_features=1, bias=True)
        )
    )
)
from clinicadl.optim.optimizers.config import AdamConfig
from clinicadl.optim.lr_schedulers.config import ReduceLROnPlateauConfig

optimizer_config = AdamConfig(
    rho={"convolutions.layer0": 0.99, "ELSE": 0.9}
)
lr_scheduler_config = ReduceLROnPlateauConfig(
    min_lr={"convolutions.layer0": 1e-2, "ELSE": 1e-3}
)

The optimizer is not passed here.

parameter mode: Mode = 'min'
parameter factor: PositiveFloat = 0.1
parameter patience: NonNegativeInt = 10
parameter threshold: NonNegativeFloat = 0.0001
parameter threshold_mode: ThresholdMode = 'rel'
parameter cooldown: NonNegativeInt = 0
parameter min_lr: Union[NonNegativeFloat, Sequence[NonNegativeFloat], Dict[str, NonNegativeFloat]] = 0
parameter eps: NonNegativeFloat = 1e-08