Learn R Programming

cito (version 1.1)

config_lr_scheduler: Creation of customized learning rate scheduler objects

Description

Helps create custom learning rate schedulers for dnn.

Usage

config_lr_scheduler(
  type = c("lambda", "multiplicative", "reduce_on_plateau", "one_cycle", "step"),
  verbose = FALSE,
  ...
)

Value

object of class cito_lr_scheduler to give to dnn

Arguments

type

String defining which type of scheduler should be used. See Details.

verbose

If TRUE, additional information about scheduler will be printed to console.

...

additional arguments to be passed to scheduler. See Details.

Details

different learning rate scheduler need different variables, these functions will tell you which variables can be set:

  • lambda: lr_lambda

  • multiplicative: lr_multiplicative

  • reduce_on_plateau: lr_reduce_on_plateau

  • one_cycle: lr_one_cycle

  • step: lr_step

Examples

Run this code
# \donttest{
if(torch::torch_is_installed()){
library(cito)

# create learning rate scheduler object
scheduler <- config_lr_scheduler(type = "step",
                        step_size = 30,
                        gamma = 0.15,
                        verbose = TRUE)

# Build and train  Network
nn.fit<- dnn(Sepal.Length~., data = datasets::iris, lr_scheduler = scheduler)

}
# }

Run the code above in your browser using DataLab