Xgboost: KeyError: 'base_score' in XGBClassifier with xgboost >= 1.0.0

Created on 14 May 2020  路  2Comments  路  Source: dmlc/xgboost

I have the following error with xgboost >= 1.0.0, Which I haven't with xgboost == 0.90

Calling XGBClassifier()
System: windows

Traceback (most recent call last): File "<input>", line 1, in <module> File "C:\MyProgramFiles\venv\project\lib\site-packages\sklearn\base.py", line 279, in __repr__ repr_ = pp.pformat(self) File "C:\MyProgramFiles\Python\Python37\lib\pprint.py", line 144, in pformat self._format(object, sio, 0, 0, {}, 0) File "C:\MyProgramFiles\Python\Python37\lib\pprint.py", line 161, in _format rep = self._repr(object, context, level) File "C:\MyProgramFiles\Python\Python37\lib\pprint.py", line 393, in _repr self._depth, level) File "C:\MyProgramFiles\venv\project\lib\site-packages\sklearn\utils\_pprint.py", line 170, in format changed_only=self._changed_only) File "C:\MyProgramFiles\venv\project\lib\site-packages\sklearn\utils\_pprint.py", line 414, in _safe_repr params = _changed_params(object) File "C:\MyProgramFiles\venv\project\lib\site-packages\sklearn\utils\_pprint.py", line 98, in _changed_params if (repr(v) != repr(init_params[k]) and File "C:\MyProgramFiles\venv\project\lib\site-packages\sklearn\base.py", line 279, in __repr__ repr_ = pp.pformat(self) File "C:\MyProgramFiles\Python\Python37\lib\pprint.py", line 144, in pformat self._format(object, sio, 0, 0, {}, 0) File "C:\MyProgramFiles\Python\Python37\lib\pprint.py", line 161, in _format rep = self._repr(object, context, level) File "C:\MyProgramFiles\Python\Python37\lib\pprint.py", line 393, in _repr self._depth, level) File "C:\MyProgramFiles\venv\project\lib\site-packages\sklearn\utils\_pprint.py", line 170, in format changed_only=self._changed_only) File "C:\MyProgramFiles\venv\project\lib\site-packages\sklearn\utils\_pprint.py", line 414, in _safe_repr params = _changed_params(object) File "C:\MyProgramFiles\venv\project\lib\site-packages\sklearn\utils\_pprint.py", line 98, in _changed_params if (repr(v) != repr(init_params[k]) and KeyError: 'base_score'

Most helpful comment

I had the same issue with scikit-learn version 0.23, not 0.22.

All 2 comments

I had the same issue with scikit-learn version 0.23, not 0.22.

I was having the issue cause with the new update if you use XGBClassifiers as super class,
the model parameters have to be specified in the __init__.

With the update in my subclass, now works.

Was this page helpful?
0 / 5 - 0 ratings