From 4df246191f9c0dcbe38ff6736fc489eac9d7d6a6 Mon Sep 17 00:00:00 2001 From: Philip Hyunsu Cho Date: Wed, 3 Jul 2019 23:37:53 -0700 Subject: [PATCH] Add warning when save_model() is called from scikit-learn interface (#4632) --- python-package/xgboost/sklearn.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/python-package/xgboost/sklearn.py b/python-package/xgboost/sklearn.py index 8d4f7d03f..884a013ff 100644 --- a/python-package/xgboost/sklearn.py +++ b/python-package/xgboost/sklearn.py @@ -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):