optuna/deprecated-suggest-api
| Pack | Severity | Fix | Versions |
|---|---|---|---|
| Optuna | warning | safe, with xpd check --fix |
All versions |
Trial.suggest_uniform, Trial.suggest_loguniform, and Trial.suggest_discrete_uniform have been deprecated since Optuna 3.0 and emit a FutureWarning on every trial in Optuna 5.1 before removal in 6.0.
lr = trial.suggest_loguniform("lr", 1e-4, 1e-1)lr = trial.suggest_float("lr", 1e-4, 1e-1, log=True)What the rule reports
Section titled “What the rule reports”Calls to suggest_uniform, suggest_loguniform, and suggest_discrete_uniform in files that import optuna.
How to fix it
Section titled “How to fix it”Replace them with suggest_float, passing log=True for log-uniform sampling and step= for discrete uniform sampling. Safe autofixes apply directly with xpd check --fix.
Diagnostic message
Section titled “Diagnostic message”suggest_uniform is deprecated since Optuna 3.0 and scheduled for removal in Optuna 6.0. Call suggest_float($NAME, $LOW, $HIGH) instead.See all rules in the Optuna pack.