Restore loading model from buffer. (#5360) (#5366)

This commit is contained in:
Jiaming Yuan
2020-02-26 14:23:10 +08:00
committed by GitHub
parent 7d178cbd25
commit 2bc5d8d449
2 changed files with 16 additions and 2 deletions

View File

@@ -300,6 +300,13 @@ class TestModels(unittest.TestCase):
assert float(config['learner']['objective'][
'reg_loss_param']['scale_pos_weight']) == 0.5
buf = bst.save_raw()
from_raw = xgb.Booster()
from_raw.load_model(buf)
buf_from_raw = from_raw.save_raw()
assert buf == buf_from_raw
def test_model_json_io(self):
loc = locale.getpreferredencoding(False)
model_path = 'test_model_json_io.json'