备注
前往结尾 下载完整示例代码。
plot_hypervolume_history
- optuna.visualization.plot_hypervolume_history(study, reference_point)[源代码]
绘制研究中所有试验的超体积历史记录。
- 参数:
- 返回:
一个
plotly.graph_objects.Figure对象。- 返回类型:
Figure
备注
作为实验性功能在 v3.3.0 中添加。接口可能会在新版本中发生变化,恕不另行通知。请参阅 https://github.com/optuna/optuna/releases/tag/v3.3.0。
以下代码片段展示了如何绘制优化历史。
/Users/cw/baidu/code/fin_tool/github/optuna/docs/visualization_examples/optuna.visualization.plot_hypervolume_history.py:29: ExperimentalWarning:
plot_hypervolume_history is experimental (supported from v3.3.0). The interface can change in the future.
import optuna
from plotly.io import show
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)
reference_point = [100.0, 50.0]
fig = optuna.visualization.plot_hypervolume_history(study, reference_point)
show(fig)
脚本总运行时间: (0 分钟 0.061 秒)