注意
前往末尾下载完整的示例代码。
plot_terminator_improvement
- optuna.visualization.matplotlib.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
评估的误差。请注意,此函数可能需要一些时间来计算改进潜力。- 参数:
plot_error (bool) – 显示误差的标志。如果设置为
True
,使用error_evaluator
评估的误差也将被绘制为折线图。默认为False
。improvement_evaluator (BaseImprovementEvaluator | None) – 评估目标函数改进的对象。默认为
RegretBoundEvaluator
。error_evaluator (BaseErrorEvaluator | None) – 评估目标函数固有误差的对象。默认为
CrossValidationErrorEvaluator
。min_n_trials (int) – 考虑终止前的最小试验次数。低于此值的试验的终止改进潜力将以较浅的颜色显示。默认为
20
。
- 返回:
一个
matplotlib.axes.Axes
对象。- 返回类型:
注意
作为实验性功能在 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_matplotlib_examples/optuna.visualization.matplotlib.terminator_improvement.py:41: 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]
23%|██▎ | 7/30 [00:00<00:00, 61.75it/s]
47%|████▋ | 14/30 [00:00<00:00, 48.66it/s]
67%|██████▋ | 20/30 [00:00<00:00, 44.63it/s]
83%|████████▎ | 25/30 [00:00<00:00, 42.11it/s]
100%|██████████| 30/30 [00:00<00:00, 37.11it/s]
100%|██████████| 30/30 [00:00<00:00, 41.13it/s]
<Axes: title={'center': 'Terminator Improvement Plot'}, xlabel='Trial', ylabel='Terminator Improvement'>
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 optuna.terminator import report_cross_validation_scores
from optuna.visualization.matplotlib 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)
plot_terminator_improvement(study, plot_error=True)
脚本总运行时间: (0 分钟 2.573 秒)