【问题标题】:Latest XGboost and Sklearn giving error最新的 XGboost 和 Sklearn 给出错误
【发布时间】:2020-09-01 20:51:11
【问题描述】:
xgb=XGBClassifier(objective="binary:logistic", n_estimators=100, random_state=42, eval_metric=["auc"])

xgb.fit(X_train, y_train)

KeyError Traceback(最近一次调用最后一次) ~/.pyenv/versions/3.7.4/envs/py3env/lib/python3.7/site-packages/IPython/core/formatters.py in call(self, obj, include, exclude) 968 969 如果方法不是无: --> 970 返回方法(include=include, exclude=exclude) 971 返回无 972 其他:

~/.pyenv/versions/3.7.4/envs/py3env/lib/python3.7/site-packages/sklearn/base.py in _repr_mimebundle_(self, **kwargs) 461 第462章 --> 463 """第 i 个双簇的行和列索引。 464 465 仅当 rows_columns_ 属性存在时才有效。

~/.pyenv/versions/3.7.4/envs/py3env/lib/python3.7/site-packages/sklearn/base.py in repr(self, N_CHAR_MAX) 第277章 278 --> 279 省略号 = '...' 280 如果 left_lim + len(ellipsis)

~/.pyenv/versions/3.7.4/lib/python3.7/pprint.py in pformat(self, object) 142 def pformat(自我,对象): 第143章 --> 144 self._format(object, sio, 0, 0, {}, 0) 第145章 146

~/.pyenv/versions/3.7.4/lib/python3.7/pprint.py in _format(self、object、stream、indent、allowance、context、level) 159 自我._可读=假 160回 --> 161 rep = self._repr(object, context, level) 162 max_width = self._width - 缩进 - 余量 163 如果 len(rep) > max_width:

~/.pyenv/versions/3.7.4/lib/python3.7/pprint.py in _repr(self, object, context, level) 第391章 392 repr,可读,递归 = self.format(object,context.copy(), --> 393 self._depth, level) 394 如果不可读: 第395章

~/.pyenv/versions/3.7.4/envs/py3env/lib/python3.7/site-packages/sklearn/utils/_pprint.py 格式(self,object,context,maxlevels,level) 168 def 格式(自我、对象、上下文、最大级别、级别): 第169章 --> 170 changed_only=self._changed_only) 171 172 def _pprint_estimator(自我,对象,流,缩进,余量,上下文,

~/.pyenv/versions/3.7.4/envs/py3env/lib/python3.7/site-packages/sklearn/utils/_pprint.py in _safe_repr(object, context, maxlevels, level, changed_only) 412 如果 changed_only: 第413章 --> 414 其他: 415 参数=对象.get_params(深=假) 416 个组件 = []

~/.pyenv/versions/3.7.4/envs/py3env/lib/python3.7/site-packages/sklearn/utils/_pprint.py in _changed_pa​​rams(估计器) 96 init_params = {name: param.default for name, param init_params.items()} 97 for k, v in params.items(): ---> 98 if (repr(v) != repr(init_params[k]) 和 99 不是(is_scalar_nan(init_params[k]) 和 is_scalar_nan(v))): 100 过滤参数[k] = v

KeyError: 'base_score'

名称:xgboost 版本:1.0.2

scikit-learn-0.23.0

pyhton 3

【问题讨论】:

    标签: scikit-learn xgboost


    【解决方案1】:

    看起来这是 scikit-learn 更新的错误 - 检查 https://github.com/dmlc/xgboost/issues/5668 - 猜想它已经解决了。

    【讨论】:

    • 是的,该修复有效。您应该能够检查问题中的提交 - 解决了问题。
    • 你能告诉我你为使它工作所遵循的步骤吗
    猜你喜欢
    • 2017-09-01
    • 2021-09-25
    • 2014-05-11
    • 2018-03-27
    • 2021-03-23
    • 2020-10-25
    • 2019-11-18
    • 1970-01-01
    • 2019-01-18
    相关资源
    最近更新 更多