Utility function to construct optimiser from keras, primarily for internal use.
get_keras_optimizer(
optimizer = "adam",
lr = 0.001,
beta_1 = 0.9,
beta_2 = 0.999,
epsilon = 1e-07,
decay = NULL,
clipnorm = NULL,
clipvalue = NULL,
momentum = 0,
nesterov = FALSE,
rho = 0.95,
global_clipnorm = NULL,
use_ema = FALSE,
ema_momentum = 0.99,
ema_overwrite_frequency = NULL,
jit_compile = TRUE,
initial_accumultator_value = 0.1,
amsgrad = FALSE,
lr_power = -0.5,
l1_regularization_strength = 0,
l2_regularization_strength = 0,
l2_shrinkage_regularization_strength = 0,
beta = 0,
centered = FALSE
)
(character(1))
Optimizer to construct, see details for those available.
Default is "adam"
.
(numeric(1))
Learning rate passed to all optimizers.
(numeric(1))
Passed to adamax
, adam
, and nadam
.
(numeric(1))
Passed to adadelta
, adagrad
, adam
, adamax
, nadam
, rmsprop
(numeric(1))
Passed to all optimizers.
(numeric(1))
Passed to rmsprop
and sgd
.
(logical(1))
Passed to sgd
.
(numeric(1))
Passed to adadelta
and rmsprop
.
(logical(1))
Passed to all optimizers.
(numeric(1))
Passed to all optimizers.
(numeric(1))
Passed to adagrad
and ftrl
.
(logical(1))
Passed to adam
and sgd
.
(numeric(1))
Passed to ftrl
.
(logical(1))
Passed to rmsprop
.
Implemented optimizers are
"adadelta"
keras::optimizer_adadelta
"adagrad"
keras::optimizer_adagrad
"adam"
keras::optimizer_adam
"adamax"
keras::optimizer_adamax
"ftrl"
keras::optimizer_ftrl
"nadam"
keras::optimizer_nadam
"rmsprop"
keras::optimizer_rmsprop
"sgd"
keras::optimizer_sgd
# \donttest{
if (requireNamespaces("keras")) {
get_keras_optimizer()
get_keras_optimizer(optimizer = "adamax", decay = 0.1, lr = 0.01)
}
#> List of 22
#> $ python : chr "/usr/local/bin/python3"
#> $ libpython : chr "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/config-3.12-darwin/libpython3.12.dylib"
#> $ pythonhome : chr "/Library/Frameworks/Python.framework/Versions/3.12:/Library/Frameworks/Python.framework/Versions/3.12"
#> $ pythonpath : chr "/Users/runner/work/_temp/Library/reticulate/config:/Library/Frameworks/Python.framework/Versions/3.12/lib/pytho"| __truncated__
#> $ prefix : chr "/Library/Frameworks/Python.framework/Versions/3.12"
#> $ exec_prefix : chr "/Library/Frameworks/Python.framework/Versions/3.12"
#> $ base_exec_prefix : chr "/Library/Frameworks/Python.framework/Versions/3.12"
#> $ virtualenv : chr ""
#> $ virtualenv_activate : chr ""
#> $ executable : chr "/usr/local/bin/python3"
#> $ base_executable : chr "/Library/Frameworks/Python.framework/Versions/3.12/bin/python3.12"
#> $ version_string : chr "3.12.2 (v3.12.2:6abddd9f6a, Feb 6 2024, 17:02:06) [Clang 13.0.0 (clang-1300.0.29.30)]"
#> $ version : chr "3.12"
#> $ architecture : chr "64bit"
#> $ anaconda : logi FALSE
#> $ conda : chr "False"
#> $ numpy : NULL
#> $ required_module : chr "tensorflow"
#> $ required_module_path: NULL
#> $ available : logi TRUE
#> $ python_versions : chr [1:2] "/usr/local/bin/python3" "/Library/Frameworks/Python.framework/Versions/3.12/bin/python"
#> $ forced : NULL
#> - attr(*, "class")= chr "py_config"
#> Error: Python module tensorflow.keras was not found.
#>
#> Detected Python configuration:
#>
#>
# }