Fix model slicing. (#7149)

* Use correct pointer.
* Remove best_iteration/best_score.
This commit is contained in:
Jiaming Yuan
2021-08-03 11:51:56 +08:00
committed by GitHub
parent 36346f8f56
commit d080b5a953
6 changed files with 37 additions and 5 deletions

View File

@@ -99,6 +99,8 @@ eval[test] = {data_path}
# CLI model doesn't contain feature info.
booster.feature_names = None
booster.feature_types = None
booster.set_attr(best_iteration=None)
booster.set_attr(best_ntree_limit=None)
booster.save_model(model_out_py)
py_predt = booster.predict(data)

View File

@@ -114,7 +114,8 @@ def run_data_iterator(
if tree_method != "gpu_hist":
rtol = 1e-1 # flaky
else:
np.testing.assert_allclose(it_predt, arr_predt, rtol=1e-3)
# Model can be sensitive to quantiles, use 1e-2 to relax the test.
np.testing.assert_allclose(it_predt, arr_predt, rtol=1e-2)
rtol = 1e-6
np.testing.assert_allclose(