Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Magic number base_score=4.786924 #5529

Closed
sh1ng opened this issue Apr 14, 2020 · 1 comment · Fixed by #5532
Closed

Magic number base_score=4.786924 #5529

sh1ng opened this issue Apr 14, 2020 · 1 comment · Fixed by #5532
Labels

Comments

@sh1ng
Copy link
Contributor

sh1ng commented Apr 14, 2020

import xgboost
import numpy as np

model = xgboost.XGBRegressor(base_score=4.786924)
X = np.random.rand(167, 20)
y = np.random.rand(167)
model.fit(X, y)
model.get_booster().save_model('model.bin')
del model

model = xgboost.XGBRegressor()
model.load_model('model.bin')
  File "/home/sh1ng/dev/.venv/lib/python3.6/site-packages/xgboost/sklearn.py", line 420, in load_model
    self._Booster.load_model(fname)
  File "/home/sh1ng/dev/.venv/lib/python3.6/site-packages/xgboost/core.py", line 1534, in load_model
    self.handle, c_str(os_fspath(fname))))
  File "/home/sh1ng/dev/.venv/lib/python3.6/site-packages/xgboost/core.py", line 189, in _check_call
    raise XGBoostError(py_str(_LIB.XGBGetLastError()))
  File "/home/sh1ng/dev/.venv/lib/python3.6/site-packages/xgboost/compat.py", line 19, in py_str
    return x.decode('utf-8')
UnicodeDecodeError: 'utf-8' codec can't decode byte 0x99 in position 99: invalid start byte

Underlying error message that can't be decoded

b'[14:56:32] /workspace/src/common/json.cc:413: Expecting: """, got: ". ", around character: 1\n    {.\x99@\x14'

Funny part is changing base_score's value solves the issue

@trivialfis
Copy link
Member

....... That's a very good catch !!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants