Skip to content

Magic number base_score=4.786924  #5529

Closed
@sh1ng

Description

@sh1ng
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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions