XGBClassifier 默认参数在 Python 中打印为 None

发布于 2025-01-16 21:42:30 字数 909 浏览 1 评论 0原文

我正在尝试在 python 笔记本中使用 XGBClassifier 作为:

from xgboost import XGBClassifier

要查看我使用的默认参数的值:

XGBClassifier()

它打印以下输出,其中 None 是所有参数的默认值:

XGBClassifier(base_score=None, booster=None, colsample_bylevel=None,
          colsample_bynode=None, colsample_bytree=None,
          enable_categorical=False, gamma=None, gpu_id=None,
          importance_type=None, interaction_constraints=None,
          learning_rate=None, max_delta_step=None, max_depth=None,
          min_child_weight=None, missing=nan, monotone_constraints=None,
          n_estimators=100, n_jobs=None, num_parallel_tree=None,
          predictor=None, random_state=None, reg_alpha=None,
          reg_lambda=None, scale_pos_weight=None, subsample=None,
          tree_method=None, validate_parameters=None, verbosity=None)

有人可以告诉我为什么所有这些值都是 None 吗?

I am trying to use XGBClassifier in python notebook as:

from xgboost import XGBClassifier

To see the value of default parameters used I did:

XGBClassifier()

It prints the following output with None being the default value of all parameters:

XGBClassifier(base_score=None, booster=None, colsample_bylevel=None,
          colsample_bynode=None, colsample_bytree=None,
          enable_categorical=False, gamma=None, gpu_id=None,
          importance_type=None, interaction_constraints=None,
          learning_rate=None, max_delta_step=None, max_depth=None,
          min_child_weight=None, missing=nan, monotone_constraints=None,
          n_estimators=100, n_jobs=None, num_parallel_tree=None,
          predictor=None, random_state=None, reg_alpha=None,
          reg_lambda=None, scale_pos_weight=None, subsample=None,
          tree_method=None, validate_parameters=None, verbosity=None)

Can someone please tell me why all these values are None?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

云雾 2025-01-23 21:42:30

有点不幸的是,这些 python 类的默认参数 (来源)。真正的默认超参数存储在 python 包装器调用的 C++ 代码中。

Somewhat unfortunately, those are the default parameters for the python class (source). The real default hyperparameters are stored in the C++ code that the python wrapper calls on.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文