optuna/log-with-step
| Pack | Severity | Fix | Versions |
|---|---|---|---|
| Optuna | error | none, edit by hand | All versions |
Optuna rejects combining log=True with step= on suggest_float and rejects any step != 1 with log=True on suggest_int.
n_trees = trial.suggest_int("n_estimators", 20, 400, step=10, log=True)n_trees = trial.suggest_int("n_estimators", 20, 400, log=True)What the rule reports
Section titled “What the rule reports”Calls to suggest_float(..., step=..., log=True) with a non-None step, and calls to suggest_int(..., step=..., log=True) where step is neither None nor 1.
How to fix it
Section titled “How to fix it”Remove step= when sampling on a log scale, or remove log=True when sampling on a uniform discrete grid.
Diagnostic message
Section titled “Diagnostic message”suggest_float cannot combine log=True with step=, and Optuna raises ValueError("The parameter `step` is not supported when `log` is true."). Drop either step= or log=True.See all rules in the Optuna pack.