plot_terminator_improvement

optuna.visualization.plot_terminator_improvement(study, plot_error=False, improvement_evaluator=None, error_evaluator=None, min_n_trials=20)[source]

绘制未来目标改进的潜力。

此函数使用 improvement_evaluator 评估并可视化目标改进的潜力。它有助于确定我们是否应该继续优化。如果将 plot_error 参数设置为 True,您还可以绘制使用 error_evaluator 评估的误差。请注意,此函数可能需要一些时间来计算改进潜力。

参数:
  • study (Study) – 一个 Study 对象,其试验用于绘制改进情况。

  • plot_error (bool) – 显示误差的标志。如果设置为 True,则使用 error_evaluator 评估的误差也会以折线图形式绘制。默认为 False

  • improvement_evaluator (BaseImprovementEvaluator | None) – 用于评估目标函数改进的对象。默认为 RegretBoundEvaluator

  • error_evaluator (BaseErrorEvaluator | None) – 用于评估目标函数固有误差的对象。默认为 CrossValidationErrorEvaluator

  • min_n_trials (int) – 在考虑终止之前所需的最小试验次数。低于此值的试验的终止器改进会以较浅的颜色显示。默认为 20

返回值:

一个 plotly.graph_objects.Figure 对象。

返回类型:

Figure

注意

作为实验性功能在 v3.2.0 中添加。接口在后续版本中可能会发生变化,恕不另行通知。参见 https://github.com/optuna/optuna/releases/tag/v3.2.0

以下代码片段展示了如何绘制改进潜力以及交叉验证误差。

/home/docs/checkouts/readthedocs.org/user_builds/optuna/envs/stable/lib/python3.12/site-packages/sklearn/utils/validation.py:2739: UserWarning:

X does not have valid feature names, but LGBMClassifier was fitted with feature names

/home/docs/checkouts/readthedocs.org/user_builds/optuna/envs/stable/lib/python3.12/site-packages/sklearn/utils/validation.py:2739: UserWarning:

X does not have valid feature names, but LGBMClassifier was fitted with feature names

/home/docs/checkouts/readthedocs.org/user_builds/optuna/envs/stable/lib/python3.12/site-packages/sklearn/utils/validation.py:2739: UserWarning:

X does not have valid feature names, but LGBMClassifier was fitted with feature names

/home/docs/checkouts/readthedocs.org/user_builds/optuna/envs/stable/lib/python3.12/site-packages/sklearn/utils/validation.py:2739: UserWarning:

X does not have valid feature names, but LGBMClassifier was fitted with feature names

/home/docs/checkouts/readthedocs.org/user_builds/optuna/envs/stable/lib/python3.12/site-packages/sklearn/utils/validation.py:2739: UserWarning:

X does not have valid feature names, but LGBMClassifier was fitted with feature names

/home/docs/checkouts/readthedocs.org/user_builds/optuna/envs/stable/lib/python3.12/site-packages/sklearn/utils/validation.py:2739: UserWarning:

X does not have valid feature names, but LGBMClassifier was fitted with feature names

/home/docs/checkouts/readthedocs.org/user_builds/optuna/envs/stable/lib/python3.12/site-packages/sklearn/utils/validation.py:2739: UserWarning:

X does not have valid feature names, but LGBMClassifier was fitted with feature names

/home/docs/checkouts/readthedocs.org/user_builds/optuna/envs/stable/lib/python3.12/site-packages/sklearn/utils/validation.py:2739: UserWarning:

X does not have valid feature names, but LGBMClassifier was fitted with feature names

/home/docs/checkouts/readthedocs.org/user_builds/optuna/envs/stable/lib/python3.12/site-packages/sklearn/utils/validation.py:2739: UserWarning:

X does not have valid feature names, but LGBMClassifier was fitted with feature names

/home/docs/checkouts/readthedocs.org/user_builds/optuna/envs/stable/lib/python3.12/site-packages/sklearn/utils/validation.py:2739: UserWarning:

X does not have valid feature names, but LGBMClassifier was fitted with feature names

/home/docs/checkouts/readthedocs.org/user_builds/optuna/envs/stable/lib/python3.12/site-packages/sklearn/utils/validation.py:2739: UserWarning:

X does not have valid feature names, but LGBMClassifier was fitted with feature names

/home/docs/checkouts/readthedocs.org/user_builds/optuna/envs/stable/lib/python3.12/site-packages/sklearn/utils/validation.py:2739: UserWarning:

X does not have valid feature names, but LGBMClassifier was fitted with feature names

/home/docs/checkouts/readthedocs.org/user_builds/optuna/envs/stable/lib/python3.12/site-packages/sklearn/utils/validation.py:2739: UserWarning:

X does not have valid feature names, but LGBMClassifier was fitted with feature names

/home/docs/checkouts/readthedocs.org/user_builds/optuna/envs/stable/lib/python3.12/site-packages/sklearn/utils/validation.py:2739: UserWarning:

X does not have valid feature names, but LGBMClassifier was fitted with feature names

/home/docs/checkouts/readthedocs.org/user_builds/optuna/envs/stable/lib/python3.12/site-packages/sklearn/utils/validation.py:2739: UserWarning:

X does not have valid feature names, but LGBMClassifier was fitted with feature names

/home/docs/checkouts/readthedocs.org/user_builds/optuna/envs/stable/lib/python3.12/site-packages/sklearn/utils/validation.py:2739: UserWarning:

X does not have valid feature names, but LGBMClassifier was fitted with feature names

/home/docs/checkouts/readthedocs.org/user_builds/optuna/envs/stable/lib/python3.12/site-packages/sklearn/utils/validation.py:2739: UserWarning:

X does not have valid feature names, but LGBMClassifier was fitted with feature names

/home/docs/checkouts/readthedocs.org/user_builds/optuna/envs/stable/lib/python3.12/site-packages/sklearn/utils/validation.py:2739: UserWarning:

X does not have valid feature names, but LGBMClassifier was fitted with feature names

/home/docs/checkouts/readthedocs.org/user_builds/optuna/envs/stable/lib/python3.12/site-packages/sklearn/utils/validation.py:2739: UserWarning:

X does not have valid feature names, but LGBMClassifier was fitted with feature names

/home/docs/checkouts/readthedocs.org/user_builds/optuna/envs/stable/lib/python3.12/site-packages/sklearn/utils/validation.py:2739: UserWarning:

X does not have valid feature names, but LGBMClassifier was fitted with feature names

/home/docs/checkouts/readthedocs.org/user_builds/optuna/envs/stable/lib/python3.12/site-packages/sklearn/utils/validation.py:2739: UserWarning:

X does not have valid feature names, but LGBMClassifier was fitted with feature names

/home/docs/checkouts/readthedocs.org/user_builds/optuna/envs/stable/lib/python3.12/site-packages/sklearn/utils/validation.py:2739: UserWarning:

X does not have valid feature names, but LGBMClassifier was fitted with feature names

/home/docs/checkouts/readthedocs.org/user_builds/optuna/envs/stable/lib/python3.12/site-packages/sklearn/utils/validation.py:2739: UserWarning:

X does not have valid feature names, but LGBMClassifier was fitted with feature names

/home/docs/checkouts/readthedocs.org/user_builds/optuna/envs/stable/lib/python3.12/site-packages/sklearn/utils/validation.py:2739: UserWarning:

X does not have valid feature names, but LGBMClassifier was fitted with feature names

/home/docs/checkouts/readthedocs.org/user_builds/optuna/envs/stable/lib/python3.12/site-packages/sklearn/utils/validation.py:2739: UserWarning:

X does not have valid feature names, but LGBMClassifier was fitted with feature names

/home/docs/checkouts/readthedocs.org/user_builds/optuna/envs/stable/lib/python3.12/site-packages/sklearn/utils/validation.py:2739: UserWarning:

X does not have valid feature names, but LGBMClassifier was fitted with feature names

/home/docs/checkouts/readthedocs.org/user_builds/optuna/envs/stable/lib/python3.12/site-packages/sklearn/utils/validation.py:2739: UserWarning:

X does not have valid feature names, but LGBMClassifier was fitted with feature names

/home/docs/checkouts/readthedocs.org/user_builds/optuna/envs/stable/lib/python3.12/site-packages/sklearn/utils/validation.py:2739: UserWarning:

X does not have valid feature names, but LGBMClassifier was fitted with feature names

/home/docs/checkouts/readthedocs.org/user_builds/optuna/envs/stable/lib/python3.12/site-packages/sklearn/utils/validation.py:2739: UserWarning:

X does not have valid feature names, but LGBMClassifier was fitted with feature names

/home/docs/checkouts/readthedocs.org/user_builds/optuna/envs/stable/lib/python3.12/site-packages/sklearn/utils/validation.py:2739: UserWarning:

X does not have valid feature names, but LGBMClassifier was fitted with feature names

/home/docs/checkouts/readthedocs.org/user_builds/optuna/envs/stable/lib/python3.12/site-packages/sklearn/utils/validation.py:2739: UserWarning:

X does not have valid feature names, but LGBMClassifier was fitted with feature names

/home/docs/checkouts/readthedocs.org/user_builds/optuna/envs/stable/lib/python3.12/site-packages/sklearn/utils/validation.py:2739: UserWarning:

X does not have valid feature names, but LGBMClassifier was fitted with feature names

/home/docs/checkouts/readthedocs.org/user_builds/optuna/envs/stable/lib/python3.12/site-packages/sklearn/utils/validation.py:2739: UserWarning:

X does not have valid feature names, but LGBMClassifier was fitted with feature names

/home/docs/checkouts/readthedocs.org/user_builds/optuna/envs/stable/lib/python3.12/site-packages/sklearn/utils/validation.py:2739: UserWarning:

X does not have valid feature names, but LGBMClassifier was fitted with feature names

/home/docs/checkouts/readthedocs.org/user_builds/optuna/envs/stable/lib/python3.12/site-packages/sklearn/utils/validation.py:2739: UserWarning:

X does not have valid feature names, but LGBMClassifier was fitted with feature names

/home/docs/checkouts/readthedocs.org/user_builds/optuna/envs/stable/lib/python3.12/site-packages/sklearn/utils/validation.py:2739: UserWarning:

X does not have valid feature names, but LGBMClassifier was fitted with feature names

/home/docs/checkouts/readthedocs.org/user_builds/optuna/envs/stable/lib/python3.12/site-packages/sklearn/utils/validation.py:2739: UserWarning:

X does not have valid feature names, but LGBMClassifier was fitted with feature names

/home/docs/checkouts/readthedocs.org/user_builds/optuna/envs/stable/lib/python3.12/site-packages/sklearn/utils/validation.py:2739: UserWarning:

X does not have valid feature names, but LGBMClassifier was fitted with feature names

/home/docs/checkouts/readthedocs.org/user_builds/optuna/envs/stable/lib/python3.12/site-packages/sklearn/utils/validation.py:2739: UserWarning:

X does not have valid feature names, but LGBMClassifier was fitted with feature names

/home/docs/checkouts/readthedocs.org/user_builds/optuna/envs/stable/lib/python3.12/site-packages/sklearn/utils/validation.py:2739: UserWarning:

X does not have valid feature names, but LGBMClassifier was fitted with feature names

/home/docs/checkouts/readthedocs.org/user_builds/optuna/envs/stable/lib/python3.12/site-packages/sklearn/utils/validation.py:2739: UserWarning:

X does not have valid feature names, but LGBMClassifier was fitted with feature names

/home/docs/checkouts/readthedocs.org/user_builds/optuna/envs/stable/lib/python3.12/site-packages/sklearn/utils/validation.py:2739: UserWarning:

X does not have valid feature names, but LGBMClassifier was fitted with feature names

/home/docs/checkouts/readthedocs.org/user_builds/optuna/envs/stable/lib/python3.12/site-packages/sklearn/utils/validation.py:2739: UserWarning:

X does not have valid feature names, but LGBMClassifier was fitted with feature names

/home/docs/checkouts/readthedocs.org/user_builds/optuna/envs/stable/lib/python3.12/site-packages/sklearn/utils/validation.py:2739: UserWarning:

X does not have valid feature names, but LGBMClassifier was fitted with feature names

/home/docs/checkouts/readthedocs.org/user_builds/optuna/envs/stable/lib/python3.12/site-packages/sklearn/utils/validation.py:2739: UserWarning:

X does not have valid feature names, but LGBMClassifier was fitted with feature names

/home/docs/checkouts/readthedocs.org/user_builds/optuna/envs/stable/lib/python3.12/site-packages/sklearn/utils/validation.py:2739: UserWarning:

X does not have valid feature names, but LGBMClassifier was fitted with feature names

/home/docs/checkouts/readthedocs.org/user_builds/optuna/envs/stable/lib/python3.12/site-packages/sklearn/utils/validation.py:2739: UserWarning:

X does not have valid feature names, but LGBMClassifier was fitted with feature names

/home/docs/checkouts/readthedocs.org/user_builds/optuna/envs/stable/lib/python3.12/site-packages/sklearn/utils/validation.py:2739: UserWarning:

X does not have valid feature names, but LGBMClassifier was fitted with feature names

/home/docs/checkouts/readthedocs.org/user_builds/optuna/envs/stable/lib/python3.12/site-packages/sklearn/utils/validation.py:2739: UserWarning:

X does not have valid feature names, but LGBMClassifier was fitted with feature names

/home/docs/checkouts/readthedocs.org/user_builds/optuna/envs/stable/lib/python3.12/site-packages/sklearn/utils/validation.py:2739: UserWarning:

X does not have valid feature names, but LGBMClassifier was fitted with feature names

/home/docs/checkouts/readthedocs.org/user_builds/optuna/envs/stable/lib/python3.12/site-packages/sklearn/utils/validation.py:2739: UserWarning:

X does not have valid feature names, but LGBMClassifier was fitted with feature names

/home/docs/checkouts/readthedocs.org/user_builds/optuna/envs/stable/lib/python3.12/site-packages/sklearn/utils/validation.py:2739: UserWarning:

X does not have valid feature names, but LGBMClassifier was fitted with feature names

/home/docs/checkouts/readthedocs.org/user_builds/optuna/envs/stable/lib/python3.12/site-packages/sklearn/utils/validation.py:2739: UserWarning:

X does not have valid feature names, but LGBMClassifier was fitted with feature names

/home/docs/checkouts/readthedocs.org/user_builds/optuna/envs/stable/lib/python3.12/site-packages/sklearn/utils/validation.py:2739: UserWarning:

X does not have valid feature names, but LGBMClassifier was fitted with feature names

/home/docs/checkouts/readthedocs.org/user_builds/optuna/envs/stable/lib/python3.12/site-packages/sklearn/utils/validation.py:2739: UserWarning:

X does not have valid feature names, but LGBMClassifier was fitted with feature names

/home/docs/checkouts/readthedocs.org/user_builds/optuna/envs/stable/lib/python3.12/site-packages/sklearn/utils/validation.py:2739: UserWarning:

X does not have valid feature names, but LGBMClassifier was fitted with feature names

/home/docs/checkouts/readthedocs.org/user_builds/optuna/envs/stable/lib/python3.12/site-packages/sklearn/utils/validation.py:2739: UserWarning:

X does not have valid feature names, but LGBMClassifier was fitted with feature names

/home/docs/checkouts/readthedocs.org/user_builds/optuna/envs/stable/lib/python3.12/site-packages/sklearn/utils/validation.py:2739: UserWarning:

X does not have valid feature names, but LGBMClassifier was fitted with feature names

/home/docs/checkouts/readthedocs.org/user_builds/optuna/envs/stable/lib/python3.12/site-packages/sklearn/utils/validation.py:2739: UserWarning:

X does not have valid feature names, but LGBMClassifier was fitted with feature names

/home/docs/checkouts/readthedocs.org/user_builds/optuna/envs/stable/lib/python3.12/site-packages/sklearn/utils/validation.py:2739: UserWarning:

X does not have valid feature names, but LGBMClassifier was fitted with feature names

/home/docs/checkouts/readthedocs.org/user_builds/optuna/envs/stable/lib/python3.12/site-packages/sklearn/utils/validation.py:2739: UserWarning:

X does not have valid feature names, but LGBMClassifier was fitted with feature names

/home/docs/checkouts/readthedocs.org/user_builds/optuna/envs/stable/lib/python3.12/site-packages/sklearn/utils/validation.py:2739: UserWarning:

X does not have valid feature names, but LGBMClassifier was fitted with feature names

/home/docs/checkouts/readthedocs.org/user_builds/optuna/envs/stable/lib/python3.12/site-packages/sklearn/utils/validation.py:2739: UserWarning:

X does not have valid feature names, but LGBMClassifier was fitted with feature names

/home/docs/checkouts/readthedocs.org/user_builds/optuna/envs/stable/lib/python3.12/site-packages/sklearn/utils/validation.py:2739: UserWarning:

X does not have valid feature names, but LGBMClassifier was fitted with feature names

/home/docs/checkouts/readthedocs.org/user_builds/optuna/envs/stable/lib/python3.12/site-packages/sklearn/utils/validation.py:2739: UserWarning:

X does not have valid feature names, but LGBMClassifier was fitted with feature names

/home/docs/checkouts/readthedocs.org/user_builds/optuna/envs/stable/lib/python3.12/site-packages/sklearn/utils/validation.py:2739: UserWarning:

X does not have valid feature names, but LGBMClassifier was fitted with feature names

/home/docs/checkouts/readthedocs.org/user_builds/optuna/envs/stable/lib/python3.12/site-packages/sklearn/utils/validation.py:2739: UserWarning:

X does not have valid feature names, but LGBMClassifier was fitted with feature names

/home/docs/checkouts/readthedocs.org/user_builds/optuna/envs/stable/lib/python3.12/site-packages/sklearn/utils/validation.py:2739: UserWarning:

X does not have valid feature names, but LGBMClassifier was fitted with feature names

/home/docs/checkouts/readthedocs.org/user_builds/optuna/envs/stable/lib/python3.12/site-packages/sklearn/utils/validation.py:2739: UserWarning:

X does not have valid feature names, but LGBMClassifier was fitted with feature names

/home/docs/checkouts/readthedocs.org/user_builds/optuna/envs/stable/lib/python3.12/site-packages/sklearn/utils/validation.py:2739: UserWarning:

X does not have valid feature names, but LGBMClassifier was fitted with feature names

/home/docs/checkouts/readthedocs.org/user_builds/optuna/envs/stable/lib/python3.12/site-packages/sklearn/utils/validation.py:2739: UserWarning:

X does not have valid feature names, but LGBMClassifier was fitted with feature names

/home/docs/checkouts/readthedocs.org/user_builds/optuna/envs/stable/lib/python3.12/site-packages/sklearn/utils/validation.py:2739: UserWarning:

X does not have valid feature names, but LGBMClassifier was fitted with feature names

/home/docs/checkouts/readthedocs.org/user_builds/optuna/envs/stable/lib/python3.12/site-packages/sklearn/utils/validation.py:2739: UserWarning:

X does not have valid feature names, but LGBMClassifier was fitted with feature names

/home/docs/checkouts/readthedocs.org/user_builds/optuna/envs/stable/lib/python3.12/site-packages/sklearn/utils/validation.py:2739: UserWarning:

X does not have valid feature names, but LGBMClassifier was fitted with feature names

/home/docs/checkouts/readthedocs.org/user_builds/optuna/envs/stable/lib/python3.12/site-packages/sklearn/utils/validation.py:2739: UserWarning:

X does not have valid feature names, but LGBMClassifier was fitted with feature names

/home/docs/checkouts/readthedocs.org/user_builds/optuna/envs/stable/lib/python3.12/site-packages/sklearn/utils/validation.py:2739: UserWarning:

X does not have valid feature names, but LGBMClassifier was fitted with feature names

/home/docs/checkouts/readthedocs.org/user_builds/optuna/envs/stable/lib/python3.12/site-packages/sklearn/utils/validation.py:2739: UserWarning:

X does not have valid feature names, but LGBMClassifier was fitted with feature names

/home/docs/checkouts/readthedocs.org/user_builds/optuna/envs/stable/lib/python3.12/site-packages/sklearn/utils/validation.py:2739: UserWarning:

X does not have valid feature names, but LGBMClassifier was fitted with feature names

/home/docs/checkouts/readthedocs.org/user_builds/optuna/envs/stable/lib/python3.12/site-packages/sklearn/utils/validation.py:2739: UserWarning:

X does not have valid feature names, but LGBMClassifier was fitted with feature names

/home/docs/checkouts/readthedocs.org/user_builds/optuna/envs/stable/lib/python3.12/site-packages/sklearn/utils/validation.py:2739: UserWarning:

X does not have valid feature names, but LGBMClassifier was fitted with feature names

/home/docs/checkouts/readthedocs.org/user_builds/optuna/envs/stable/lib/python3.12/site-packages/sklearn/utils/validation.py:2739: UserWarning:

X does not have valid feature names, but LGBMClassifier was fitted with feature names

/home/docs/checkouts/readthedocs.org/user_builds/optuna/envs/stable/lib/python3.12/site-packages/sklearn/utils/validation.py:2739: UserWarning:

X does not have valid feature names, but LGBMClassifier was fitted with feature names

/home/docs/checkouts/readthedocs.org/user_builds/optuna/envs/stable/lib/python3.12/site-packages/sklearn/utils/validation.py:2739: UserWarning:

X does not have valid feature names, but LGBMClassifier was fitted with feature names

/home/docs/checkouts/readthedocs.org/user_builds/optuna/envs/stable/lib/python3.12/site-packages/sklearn/utils/validation.py:2739: UserWarning:

X does not have valid feature names, but LGBMClassifier was fitted with feature names

/home/docs/checkouts/readthedocs.org/user_builds/optuna/envs/stable/lib/python3.12/site-packages/sklearn/utils/validation.py:2739: UserWarning:

X does not have valid feature names, but LGBMClassifier was fitted with feature names

/home/docs/checkouts/readthedocs.org/user_builds/optuna/envs/stable/lib/python3.12/site-packages/sklearn/utils/validation.py:2739: UserWarning:

X does not have valid feature names, but LGBMClassifier was fitted with feature names

/home/docs/checkouts/readthedocs.org/user_builds/optuna/envs/stable/lib/python3.12/site-packages/sklearn/utils/validation.py:2739: UserWarning:

X does not have valid feature names, but LGBMClassifier was fitted with feature names

/home/docs/checkouts/readthedocs.org/user_builds/optuna/envs/stable/lib/python3.12/site-packages/sklearn/utils/validation.py:2739: UserWarning:

X does not have valid feature names, but LGBMClassifier was fitted with feature names

/home/docs/checkouts/readthedocs.org/user_builds/optuna/envs/stable/lib/python3.12/site-packages/sklearn/utils/validation.py:2739: UserWarning:

X does not have valid feature names, but LGBMClassifier was fitted with feature names

/home/docs/checkouts/readthedocs.org/user_builds/optuna/envs/stable/lib/python3.12/site-packages/sklearn/utils/validation.py:2739: UserWarning:

X does not have valid feature names, but LGBMClassifier was fitted with feature names

/home/docs/checkouts/readthedocs.org/user_builds/optuna/envs/stable/lib/python3.12/site-packages/sklearn/utils/validation.py:2739: UserWarning:

X does not have valid feature names, but LGBMClassifier was fitted with feature names

/home/docs/checkouts/readthedocs.org/user_builds/optuna/envs/stable/lib/python3.12/site-packages/sklearn/utils/validation.py:2739: UserWarning:

X does not have valid feature names, but LGBMClassifier was fitted with feature names

/home/docs/checkouts/readthedocs.org/user_builds/optuna/envs/stable/lib/python3.12/site-packages/sklearn/utils/validation.py:2739: UserWarning:

X does not have valid feature names, but LGBMClassifier was fitted with feature names

/home/docs/checkouts/readthedocs.org/user_builds/optuna/envs/stable/lib/python3.12/site-packages/sklearn/utils/validation.py:2739: UserWarning:

X does not have valid feature names, but LGBMClassifier was fitted with feature names

/home/docs/checkouts/readthedocs.org/user_builds/optuna/envs/stable/lib/python3.12/site-packages/sklearn/utils/validation.py:2739: UserWarning:

X does not have valid feature names, but LGBMClassifier was fitted with feature names

/home/docs/checkouts/readthedocs.org/user_builds/optuna/envs/stable/lib/python3.12/site-packages/sklearn/utils/validation.py:2739: UserWarning:

X does not have valid feature names, but LGBMClassifier was fitted with feature names

/home/docs/checkouts/readthedocs.org/user_builds/optuna/envs/stable/lib/python3.12/site-packages/sklearn/utils/validation.py:2739: UserWarning:

X does not have valid feature names, but LGBMClassifier was fitted with feature names

/home/docs/checkouts/readthedocs.org/user_builds/optuna/envs/stable/lib/python3.12/site-packages/sklearn/utils/validation.py:2739: UserWarning:

X does not have valid feature names, but LGBMClassifier was fitted with feature names

/home/docs/checkouts/readthedocs.org/user_builds/optuna/envs/stable/lib/python3.12/site-packages/sklearn/utils/validation.py:2739: UserWarning:

X does not have valid feature names, but LGBMClassifier was fitted with feature names

/home/docs/checkouts/readthedocs.org/user_builds/optuna/envs/stable/lib/python3.12/site-packages/sklearn/utils/validation.py:2739: UserWarning:

X does not have valid feature names, but LGBMClassifier was fitted with feature names

/home/docs/checkouts/readthedocs.org/user_builds/optuna/envs/stable/lib/python3.12/site-packages/sklearn/utils/validation.py:2739: UserWarning:

X does not have valid feature names, but LGBMClassifier was fitted with feature names

/home/docs/checkouts/readthedocs.org/user_builds/optuna/envs/stable/lib/python3.12/site-packages/sklearn/utils/validation.py:2739: UserWarning:

X does not have valid feature names, but LGBMClassifier was fitted with feature names

/home/docs/checkouts/readthedocs.org/user_builds/optuna/envs/stable/lib/python3.12/site-packages/sklearn/utils/validation.py:2739: UserWarning:

X does not have valid feature names, but LGBMClassifier was fitted with feature names

/home/docs/checkouts/readthedocs.org/user_builds/optuna/envs/stable/lib/python3.12/site-packages/sklearn/utils/validation.py:2739: UserWarning:

X does not have valid feature names, but LGBMClassifier was fitted with feature names

/home/docs/checkouts/readthedocs.org/user_builds/optuna/envs/stable/lib/python3.12/site-packages/sklearn/utils/validation.py:2739: UserWarning:

X does not have valid feature names, but LGBMClassifier was fitted with feature names

/home/docs/checkouts/readthedocs.org/user_builds/optuna/envs/stable/lib/python3.12/site-packages/sklearn/utils/validation.py:2739: UserWarning:

X does not have valid feature names, but LGBMClassifier was fitted with feature names

/home/docs/checkouts/readthedocs.org/user_builds/optuna/envs/stable/lib/python3.12/site-packages/sklearn/utils/validation.py:2739: UserWarning:

X does not have valid feature names, but LGBMClassifier was fitted with feature names

/home/docs/checkouts/readthedocs.org/user_builds/optuna/envs/stable/lib/python3.12/site-packages/sklearn/utils/validation.py:2739: UserWarning:

X does not have valid feature names, but LGBMClassifier was fitted with feature names

/home/docs/checkouts/readthedocs.org/user_builds/optuna/envs/stable/lib/python3.12/site-packages/sklearn/utils/validation.py:2739: UserWarning:

X does not have valid feature names, but LGBMClassifier was fitted with feature names

/home/docs/checkouts/readthedocs.org/user_builds/optuna/envs/stable/lib/python3.12/site-packages/sklearn/utils/validation.py:2739: UserWarning:

X does not have valid feature names, but LGBMClassifier was fitted with feature names

/home/docs/checkouts/readthedocs.org/user_builds/optuna/envs/stable/lib/python3.12/site-packages/sklearn/utils/validation.py:2739: UserWarning:

X does not have valid feature names, but LGBMClassifier was fitted with feature names

/home/docs/checkouts/readthedocs.org/user_builds/optuna/envs/stable/lib/python3.12/site-packages/sklearn/utils/validation.py:2739: UserWarning:

X does not have valid feature names, but LGBMClassifier was fitted with feature names

/home/docs/checkouts/readthedocs.org/user_builds/optuna/envs/stable/lib/python3.12/site-packages/sklearn/utils/validation.py:2739: UserWarning:

X does not have valid feature names, but LGBMClassifier was fitted with feature names

/home/docs/checkouts/readthedocs.org/user_builds/optuna/envs/stable/lib/python3.12/site-packages/sklearn/utils/validation.py:2739: UserWarning:

X does not have valid feature names, but LGBMClassifier was fitted with feature names

/home/docs/checkouts/readthedocs.org/user_builds/optuna/envs/stable/lib/python3.12/site-packages/sklearn/utils/validation.py:2739: UserWarning:

X does not have valid feature names, but LGBMClassifier was fitted with feature names

/home/docs/checkouts/readthedocs.org/user_builds/optuna/envs/stable/lib/python3.12/site-packages/sklearn/utils/validation.py:2739: UserWarning:

X does not have valid feature names, but LGBMClassifier was fitted with feature names

/home/docs/checkouts/readthedocs.org/user_builds/optuna/envs/stable/lib/python3.12/site-packages/sklearn/utils/validation.py:2739: UserWarning:

X does not have valid feature names, but LGBMClassifier was fitted with feature names

/home/docs/checkouts/readthedocs.org/user_builds/optuna/envs/stable/lib/python3.12/site-packages/sklearn/utils/validation.py:2739: UserWarning:

X does not have valid feature names, but LGBMClassifier was fitted with feature names

/home/docs/checkouts/readthedocs.org/user_builds/optuna/envs/stable/lib/python3.12/site-packages/sklearn/utils/validation.py:2739: UserWarning:

X does not have valid feature names, but LGBMClassifier was fitted with feature names

/home/docs/checkouts/readthedocs.org/user_builds/optuna/envs/stable/lib/python3.12/site-packages/sklearn/utils/validation.py:2739: UserWarning:

X does not have valid feature names, but LGBMClassifier was fitted with feature names

/home/docs/checkouts/readthedocs.org/user_builds/optuna/envs/stable/lib/python3.12/site-packages/sklearn/utils/validation.py:2739: UserWarning:

X does not have valid feature names, but LGBMClassifier was fitted with feature names

/home/docs/checkouts/readthedocs.org/user_builds/optuna/envs/stable/lib/python3.12/site-packages/sklearn/utils/validation.py:2739: UserWarning:

X does not have valid feature names, but LGBMClassifier was fitted with feature names

/home/docs/checkouts/readthedocs.org/user_builds/optuna/envs/stable/lib/python3.12/site-packages/sklearn/utils/validation.py:2739: UserWarning:

X does not have valid feature names, but LGBMClassifier was fitted with feature names

/home/docs/checkouts/readthedocs.org/user_builds/optuna/envs/stable/lib/python3.12/site-packages/sklearn/utils/validation.py:2739: UserWarning:

X does not have valid feature names, but LGBMClassifier was fitted with feature names

/home/docs/checkouts/readthedocs.org/user_builds/optuna/envs/stable/lib/python3.12/site-packages/sklearn/utils/validation.py:2739: UserWarning:

X does not have valid feature names, but LGBMClassifier was fitted with feature names

/home/docs/checkouts/readthedocs.org/user_builds/optuna/envs/stable/lib/python3.12/site-packages/sklearn/utils/validation.py:2739: UserWarning:

X does not have valid feature names, but LGBMClassifier was fitted with feature names

/home/docs/checkouts/readthedocs.org/user_builds/optuna/envs/stable/lib/python3.12/site-packages/sklearn/utils/validation.py:2739: UserWarning:

X does not have valid feature names, but LGBMClassifier was fitted with feature names

/home/docs/checkouts/readthedocs.org/user_builds/optuna/envs/stable/lib/python3.12/site-packages/sklearn/utils/validation.py:2739: UserWarning:

X does not have valid feature names, but LGBMClassifier was fitted with feature names

/home/docs/checkouts/readthedocs.org/user_builds/optuna/envs/stable/lib/python3.12/site-packages/sklearn/utils/validation.py:2739: UserWarning:

X does not have valid feature names, but LGBMClassifier was fitted with feature names

/home/docs/checkouts/readthedocs.org/user_builds/optuna/envs/stable/lib/python3.12/site-packages/sklearn/utils/validation.py:2739: UserWarning:

X does not have valid feature names, but LGBMClassifier was fitted with feature names

/home/docs/checkouts/readthedocs.org/user_builds/optuna/envs/stable/lib/python3.12/site-packages/sklearn/utils/validation.py:2739: UserWarning:

X does not have valid feature names, but LGBMClassifier was fitted with feature names

/home/docs/checkouts/readthedocs.org/user_builds/optuna/envs/stable/lib/python3.12/site-packages/sklearn/utils/validation.py:2739: UserWarning:

X does not have valid feature names, but LGBMClassifier was fitted with feature names

/home/docs/checkouts/readthedocs.org/user_builds/optuna/envs/stable/lib/python3.12/site-packages/sklearn/utils/validation.py:2739: UserWarning:

X does not have valid feature names, but LGBMClassifier was fitted with feature names

/home/docs/checkouts/readthedocs.org/user_builds/optuna/envs/stable/lib/python3.12/site-packages/sklearn/utils/validation.py:2739: UserWarning:

X does not have valid feature names, but LGBMClassifier was fitted with feature names

/home/docs/checkouts/readthedocs.org/user_builds/optuna/envs/stable/lib/python3.12/site-packages/sklearn/utils/validation.py:2739: UserWarning:

X does not have valid feature names, but LGBMClassifier was fitted with feature names

/home/docs/checkouts/readthedocs.org/user_builds/optuna/envs/stable/lib/python3.12/site-packages/sklearn/utils/validation.py:2739: UserWarning:

X does not have valid feature names, but LGBMClassifier was fitted with feature names

/home/docs/checkouts/readthedocs.org/user_builds/optuna/envs/stable/lib/python3.12/site-packages/sklearn/utils/validation.py:2739: UserWarning:

X does not have valid feature names, but LGBMClassifier was fitted with feature names

/home/docs/checkouts/readthedocs.org/user_builds/optuna/envs/stable/lib/python3.12/site-packages/sklearn/utils/validation.py:2739: UserWarning:

X does not have valid feature names, but LGBMClassifier was fitted with feature names

/home/docs/checkouts/readthedocs.org/user_builds/optuna/envs/stable/lib/python3.12/site-packages/sklearn/utils/validation.py:2739: UserWarning:

X does not have valid feature names, but LGBMClassifier was fitted with feature names

/home/docs/checkouts/readthedocs.org/user_builds/optuna/envs/stable/lib/python3.12/site-packages/sklearn/utils/validation.py:2739: UserWarning:

X does not have valid feature names, but LGBMClassifier was fitted with feature names

/home/docs/checkouts/readthedocs.org/user_builds/optuna/envs/stable/lib/python3.12/site-packages/sklearn/utils/validation.py:2739: UserWarning:

X does not have valid feature names, but LGBMClassifier was fitted with feature names

/home/docs/checkouts/readthedocs.org/user_builds/optuna/envs/stable/lib/python3.12/site-packages/sklearn/utils/validation.py:2739: UserWarning:

X does not have valid feature names, but LGBMClassifier was fitted with feature names

/home/docs/checkouts/readthedocs.org/user_builds/optuna/envs/stable/lib/python3.12/site-packages/sklearn/utils/validation.py:2739: UserWarning:

X does not have valid feature names, but LGBMClassifier was fitted with feature names

/home/docs/checkouts/readthedocs.org/user_builds/optuna/envs/stable/lib/python3.12/site-packages/sklearn/utils/validation.py:2739: UserWarning:

X does not have valid feature names, but LGBMClassifier was fitted with feature names

/home/docs/checkouts/readthedocs.org/user_builds/optuna/envs/stable/lib/python3.12/site-packages/sklearn/utils/validation.py:2739: UserWarning:

X does not have valid feature names, but LGBMClassifier was fitted with feature names

/home/docs/checkouts/readthedocs.org/user_builds/optuna/envs/stable/lib/python3.12/site-packages/sklearn/utils/validation.py:2739: UserWarning:

X does not have valid feature names, but LGBMClassifier was fitted with feature names

/home/docs/checkouts/readthedocs.org/user_builds/optuna/envs/stable/lib/python3.12/site-packages/sklearn/utils/validation.py:2739: UserWarning:

X does not have valid feature names, but LGBMClassifier was fitted with feature names

/home/docs/checkouts/readthedocs.org/user_builds/optuna/envs/stable/lib/python3.12/site-packages/sklearn/utils/validation.py:2739: UserWarning:

X does not have valid feature names, but LGBMClassifier was fitted with feature names

/home/docs/checkouts/readthedocs.org/user_builds/optuna/envs/stable/lib/python3.12/site-packages/sklearn/utils/validation.py:2739: UserWarning:

X does not have valid feature names, but LGBMClassifier was fitted with feature names

/home/docs/checkouts/readthedocs.org/user_builds/optuna/envs/stable/lib/python3.12/site-packages/sklearn/utils/validation.py:2739: UserWarning:

X does not have valid feature names, but LGBMClassifier was fitted with feature names

/home/docs/checkouts/readthedocs.org/user_builds/optuna/checkouts/stable/docs/visualization_examples/optuna.visualization.plot_terminator_improvement.py:42: ExperimentalWarning:

plot_terminator_improvement is experimental (supported from v3.2.0). The interface can change in the future.

/home/docs/checkouts/readthedocs.org/user_builds/optuna/envs/stable/lib/python3.12/site-packages/optuna/visualization/_terminator_improvement.py:93: ExperimentalWarning:

RegretBoundEvaluator is experimental (supported from v3.2.0). The interface can change in the future.

/home/docs/checkouts/readthedocs.org/user_builds/optuna/envs/stable/lib/python3.12/site-packages/optuna/visualization/_terminator_improvement.py:98: ExperimentalWarning:

CrossValidationErrorEvaluator is experimental (supported from v3.2.0). The interface can change in the future.


  0%|          | 0/30 [00:00<?, ?it/s]
 17%|█▋        | 5/30 [00:00<00:00, 49.76it/s]
 37%|███▋      | 11/30 [00:00<00:00, 49.53it/s]
 53%|█████▎    | 16/30 [00:00<00:00, 45.16it/s]
 70%|███████   | 21/30 [00:00<00:00, 39.68it/s]
 87%|████████▋ | 26/30 [00:00<00:00, 37.30it/s]
100%|██████████| 30/30 [00:00<00:00, 35.87it/s]
100%|██████████| 30/30 [00:00<00:00, 39.07it/s]

from lightgbm import LGBMClassifier
from sklearn.datasets import load_wine
from sklearn.model_selection import cross_val_score
from sklearn.model_selection import KFold
import optuna
from plotly.io import show
from optuna.terminator import report_cross_validation_scores
from optuna.visualization import plot_terminator_improvement


def objective(trial):
    X, y = load_wine(return_X_y=True)
    clf = LGBMClassifier(
        reg_alpha=trial.suggest_float("reg_alpha", 1e-8, 10.0, log=True),
        reg_lambda=trial.suggest_float("reg_lambda", 1e-8, 10.0, log=True),
        num_leaves=trial.suggest_int("num_leaves", 2, 256),
        colsample_bytree=trial.suggest_float("colsample_bytree", 0.4, 1.0),
        subsample=trial.suggest_float("subsample", 0.4, 1.0),
        subsample_freq=trial.suggest_int("subsample_freq", 1, 7),
        min_child_samples=trial.suggest_int("min_child_samples", 5, 100),
    )
    scores = cross_val_score(clf, X, y, cv=KFold(n_splits=5, shuffle=True))
    report_cross_validation_scores(trial, scores)
    return scores.mean()


study = optuna.create_study()
study.optimize(objective, n_trials=30)

fig = plot_terminator_improvement(study, plot_error=True)
show(fig)

脚本总运行时间: (0 分钟 2.722 秒)

本图库由 Sphinx-Gallery 生成