Skip to content

Optuna

The Optuna pack checks hyperparameter search spaces, study creation, and sampler reproducibility against Optuna 5.1 on files that import optuna.

Rules Safe fix Unsafe fix Manual fix
5 1 1 3
Rule Severity Fix What it finds
deprecated-suggest-api warning safe 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.
direction-and-directions error none optuna.create_study raises ValueError: Specify only one of direction and directions. when both direction= and directions= are non-None.
log-distribution-nonpositive-low error none Log-scale sampling requires a strictly positive lower bound (low > 0 for suggest_float, low >= 1 for suggest_int).
log-with-step error none Optuna rejects combining log=True with step= on suggest_float and rejects any step != 1 with log=True on suggest_int.
Rule Severity Fix What it finds
unseeded-sampler warning unsafe Optuna's stochastic samplers default to seed=None, so re-running the same study explores different trials and selects different hyperparameters (two 10-trial TPESampler() runs on Optuna 5.1.0 returned 0.0 vs 2.293475, while seed=0 reproduced 0.174626).