Learn R Programming

mlr3misc (version 0.15.1)

set_params: Modify Values of a Parameter Set

Description

Convenience function to modfiy (or overwrite) the values of a paradox::ParamSet.

Usage

set_params(.ps, ..., .values = list(), .insert = TRUE)

Arguments

.ps

(paradox::ParamSet)
The parameter set whose values are changed.

...

(any) Named parameter values.

.values

(list()) Named list with parameter values.

.insert

(logical(1))
Whether to insert the values (old values are being kept, if not overwritten), or to discard the old values. Is TRUE by default.

Examples

Run this code
if (requireNamespace("paradox")) {
  param_set = paradox::ps(a = paradox::p_dbl(), b = paradox::p_dbl())
  param_set$values$a = 0
  set_params(param_set, a = 1, .values = list(b = 2), .insert = TRUE)
  set_params(param_set, a = 3, .insert = FALSE)
  set_params(param_set, b = 4, .insert = TRUE)
}

Run the code above in your browser using DataLab