Add warning when save_model() is called from scikit-learn interface (#4632)

This commit is contained in:
Philip Hyunsu Cho 2019-07-03 23:37:53 -07:00 committed by GitHub
parent 96bf91725b
commit 4df246191f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -278,6 +278,11 @@ class XGBModel(XGBModelBase):
fname : string
Output file name
"""
warnings.warn("save_model: Useful attributes in the Python " +
"object {} will be lost. ".format(type(self).__name__) +
"If you did not mean to export the model to " +
"a non-Python binding of XGBoost, consider " +
"using `pickle` or `joblib` to save your model.", Warning)
self.get_booster().save_model(fname)
def load_model(self, fname):