get_keras_optimizer: Get Keras Optimizer

View source: R/helpers_keras.R

get_keras_optimizerR Documentation

Get Keras Optimizer

Description

Utility function to construct optimiser from keras, primarily for internal use.

Usage

get_keras_optimizer(
  optimizer = "adam",
  lr = 0.02,
  beta_1 = 0.9,
  beta_2 = 0.999,
  epsilon = NULL,
  decay = 0,
  clipnorm = NULL,
  clipvalue = NULL,
  schedule_decay = 0.004,
  momentum = 0,
  nesterov = FALSE
)

Arguments

optimizer

(character(1))
Optimizer to construct, see details for those available. Default is "adam".

lr

(numeric(1))
Passed to all optimizers except adadelta and adagrad.

beta_1, beta_2, epsilon

(numeric(1))
Passed to adamax, adam, and nadam.

decay

(numeric(1))
Passed to adamax, adam, and sgd.

clipnorm, clipvalue

(numeric(1))
Passed to adamax, adam, nadam, and sgd.

schedule_decay

(numeric(1))
Passed to nadam.

momentum

(numeric(1))
Passed to sgd.

nesterov

(logical(1))
Passed to sgd.

Details

Implemented optimizers are

  • "adadelta"
    keras::optimizer_adadelta

  • "adagrad"
    keras::optimizer_adagrad

  • "adamax"
    keras::optimizer_adamax

  • "adam"
    keras::optimizer_adam

  • "nadam"
    keras::optimizer_nadam

  • "rmsprop"
    keras::optimizer_rmsprop

  • "sgd"
    keras::optimizer_sgd

Examples


if (requireNamespaces("keras")) {
  get_keras_optimizer()

  get_keras_optimizer(optimizer = "adamax", decay = 0.1, lr = 0.01)
}



survivalmodels documentation built on March 24, 2022, 9:05 a.m.