Skip to content

optuna/log-distribution-nonpositive-low

Pack Severity Fix Versions
Optuna error none, edit by hand All versions

Log-scale sampling requires a strictly positive lower bound (low > 0 for suggest_float, low >= 1 for suggest_int). Passing 0 or a negative literal raises ValueError during the first trial.

lr = trial.suggest_float("lr", 0.0, 1.0, log=True)
lr = trial.suggest_float("lr", 1e-4, 1.0, log=True)

Calls to suggest_float(..., log=True) or suggest_int(..., log=True) whose low bound is 0, 0.0, or negative.

Set low to a strictly positive lower bound (at least 1 for suggest_int), or set log=False when zero belongs in the search space.

suggest_float with log=True requires low > 0, and Optuna raises ValueError at runtime for non-positive low. Use a strictly positive lower bound or drop log=True.

See all rules in the Optuna pack.