Note
Go to the end to download the full example code.
plot_pareto_front
- optuna.visualization.matplotlib.plot_pareto_front(study, *, target_names=None, include_dominated_trials=True, axis_order=None, constraints_func=None, targets=None)[source]
Plot the Pareto front of a study.
See also
Please refer to
optuna.visualization.plot_pareto_front()for an example.- Parameters:
study (Study) – A
Studyobject whose trials are plotted for their objective values.study.n_objectivesmust be either 2 or 3 whentargetsisNone.target_names (list[str] | None) – Objective name list used as the axis titles. If
Noneis specified, “Objective {objective_index}” is used instead. Iftargetsis specified for a study that does not contain any completed trial,target_namemust be specified.include_dominated_trials (bool) – A flag to include all dominated trial’s objective values.
axis_order (list[int] | None) –
A list of indices indicating the axis order. If
Noneis specified, default order is used.axis_orderandtargetscannot be used at the same time.Warning
Deprecated in v3.0.0. This feature will be removed in the future. The removal of this feature is currently scheduled for v5.0.0, but this schedule is subject to change. See https://github.com/optuna/optuna/releases/tag/v3.0.0.
constraints_func (Callable[[FrozenTrial], Sequence[float]] | None) –
An optional function that computes the objective constraints. It must take a
FrozenTrialand return the constraints. The return value must be a sequence offloats. A value strictly larger than 0 means that a constraint is violated. A value equal to or smaller than 0 is considered feasible. This specification is the same as in, for example,NSGAIISampler.If given, trials are classified into three categories: feasible and best, feasible but non-best, and infeasible. Categories are shown in different colors. Here, whether a trial is best (on Pareto front) or not is determined ignoring all infeasible trials.
Warning
Deprecated in v4.0.0. This feature will be removed in the future. The removal of this feature is currently scheduled for v6.0.0, but this schedule is subject to change. See https://github.com/optuna/optuna/releases/tag/v4.0.0.
targets (Callable[[FrozenTrial], Sequence[float]] | None) –
A function that returns a tuple of target values to display. The argument to this function is
FrozenTrial.targetsmust beNoneor return 2 or 3 values.axis_orderandtargetscannot be used at the same time. If the number of objectives is neither 2 nor 3,targetsmust be specified.Note
Added in v3.0.0 as an experimental feature. The interface may change in newer versions without prior notice. See https://github.com/optuna/optuna/releases/tag/v3.0.0.
- Returns:
A
matplotlib.axes.Axesobject.- Return type:
Note
Added in v2.8.0 as an experimental feature. The interface may change in newer versions without prior notice. See https://github.com/optuna/optuna/releases/tag/v2.8.0.
The following code snippet shows how to plot the Pareto front of a study.

/home/docs/checkouts/readthedocs.org/user_builds/optuna/checkouts/stable/docs/visualization_matplotlib_examples/optuna.visualization.matplotlib.pareto_front.py:27: ExperimentalWarning: optuna.visualization.matplotlib._pareto_front.plot_pareto_front is experimental (supported from v2.8.0). The interface can change in the future.
optuna.visualization.matplotlib.plot_pareto_front(study)
<Axes: title={'center': 'Pareto-front Plot'}, xlabel='Objective 0', ylabel='Objective 1'>
import optuna
def objective(trial):
x = trial.suggest_float("x", 0, 5)
y = trial.suggest_float("y", 0, 3)
v0 = 4 * x**2 + 4 * y**2
v1 = (x - 5) ** 2 + (y - 5) ** 2
return v0, v1
study = optuna.create_study(directions=["minimize", "minimize"])
study.optimize(objective, n_trials=50)
optuna.visualization.matplotlib.plot_pareto_front(study)
Total running time of the script: (0 minutes 0.263 seconds)