Optuna
Snippets
import optuna optuna.logging.set_verbosity(optuna.logging.WARNING) def objective(trial): x = trial.suggest_int('x', 0, 10) print(f'{trial.number=},', f'{x=}') return x study = optuna.create_study() study.optimize(objective, n_trials=5) print('Best Params: ', study.best_params)
trial.number=0, x=5 trial.number=1, x=2 trial.number=2, x=5 trial.number=3, x=6 trial.number=4, x=7 Best Params: {'x': 2}