When performing a single-objective optimization with Optuna, the best parameters of the study are accessible using:
import optuna
def objective(trial):
x = trial.suggest_uniform('x', -10, 10)
return (x - 2) ** 2
study = optuna.create_study(direction='minimize')
study.optimize(objective, n_trials=100)
study.best_params # E.g. {'x': 2.002108042}
If I want to perform a multi-objective optimization, this would be become for example :
import optuna
def multi_objective(trial):
x = trial.suggest_uniform('x', -10, 10)
f1 = (x - 2) ** 2
f2 = -f1
return f1, f2
study = optuna.create_study(directions=['minimize', 'maximize'])
study.optimize(multi_objective, n_trials=100)
This works, but the command study.best_params
fails with RuntimeError: The best trial of a 'study' is only supported for single-objective optimization.
How can I get the best parameters for a multi-objective optimization ?