Helper function to define a continuous floating point hyperparameter range for Bayesian optimization.

opt_float(low, high, log = FALSE, step = NULL)

Arguments

low

Numeric. The lower bound of the range.

high

Numeric. The upper bound of the range.

log

Logical. If TRUE, the value is sampled from the range in the log domain. Useful for parameters like learning rates or regularization (alpha, gamma).

step

Numeric or NULL. The discretization step. If provided, the value will be rounded to the nearest multiple of step.

Value

An object of class "opt_param_def" defining the search strategy.

Examples

# Define a log-scale search for alpha between 0.001 and 100
space_alpha <- opt_float(0.001, 100, log = TRUE)