diff --git a/python-package/xgboost/sklearn.py b/python-package/xgboost/sklearn.py index 9557fdd64..3e67a9d5b 100644 --- a/python-package/xgboost/sklearn.py +++ b/python-package/xgboost/sklearn.py @@ -653,12 +653,6 @@ class XGBModel(XGBModelBase): save_best=True)] """ - train_dmatrix = DMatrix(data=X, label=y, weight=sample_weight, - base_margin=base_margin, - missing=self.missing, - nthread=self.n_jobs) - train_dmatrix.set_info(feature_weights=feature_weights) - evals_result = {} train_dmatrix, evals = self._wrap_evaluation_matrices( diff --git a/tests/python/test_ranking.py b/tests/python/test_ranking.py index 7d079008e..f68c47c3f 100644 --- a/tests/python/test_ranking.py +++ b/tests/python/test_ranking.py @@ -112,8 +112,12 @@ class TestRanking: Cleanup test artifacts from download and unpacking :return: """ - os.remove(cls.dpath + "MQ2008.zip") - shutil.rmtree(cls.dpath + "MQ2008") + zip_f = cls.dpath + "MQ2008.zip" + if os.path.exists(zip_f): + os.remove(zip_f) + directory = cls.dpath + "MQ2008" + if os.path.exists(directory): + shutil.rmtree(directory) def test_training(self): """