You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
pip install scikit-learn==0.23
pip install xgboost==1.0.2
python
>>> import xgboost
>>> xgboost.XGBClassifier()
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/opt/conda/lib/python3.7/site-packages/sklearn/base.py", line 279, in __repr__
repr_ = pp.pformat(self)
File "/opt/conda/lib/python3.7/pprint.py", line 144, in pformat
self._format(object, sio, 0, 0, {}, 0)
File "/opt/conda/lib/python3.7/pprint.py", line 161, in _format
rep = self._repr(object, context, level)
File "/opt/conda/lib/python3.7/pprint.py", line 393, in _repr
self._depth, level)
File "/opt/conda/lib/python3.7/site-packages/sklearn/utils/_pprint.py", line 170, in format
changed_only=self._changed_only)
File "/opt/conda/lib/python3.7/site-packages/sklearn/utils/_pprint.py", line 414, in _safe_repr
params = _changed_params(object)
File "/opt/conda/lib/python3.7/site-packages/sklearn/utils/_pprint.py", line 98, in _changed_params
if (repr(v) != repr(init_params[k]) and
KeyError: 'base_score'
The text was updated successfully, but these errors were encountered:
This is because XGBClassifier uses kwargs, while scikit-learn's pretty print assumes that all parameters are explicitly defined in the __init__.py.
(from the doc):
The arguments accepted by __init__ should all be keyword arguments with a default value.
We should fix sklearn.utils._pprint._changed_params to be more tolerant to estimators not complying with this rule, e.g. keeping all parameters that are not explicitly defined in the __init__.
Describe the bug
xgboost.XGBClassifier() throws an error
Steps/Code to Reproduce
The text was updated successfully, but these errors were encountered: