Replace all uses of deprecated function sklearn.datasets.load_boston (#7373)

* Replace all uses of deprecated function sklearn.datasets.load_boston

* More renaming

* Fix bad name

* Update assertion

* Fix n boosted rounds.

* Avoid over regularization.

* Rebase.

* Avoid over regularization.

* Whac-a-mole

Co-authored-by: fis <jm.yuan@outlook.com>
This commit is contained in:
Philip Hyunsu Cho
2022-01-30 04:27:57 -08:00
committed by GitHub
parent b4340abf56
commit c621775f34
13 changed files with 56 additions and 66 deletions

View File

@@ -425,8 +425,8 @@ def test_boost_from_prediction(tree_method: str, client: "Client") -> None:
def test_inplace_predict(client: "Client") -> None:
from sklearn.datasets import load_boston
X_, y_ = load_boston(return_X_y=True)
from sklearn.datasets import fetch_california_housing
X_, y_ = fetch_california_housing(return_X_y=True)
X, y = dd.from_array(X_, chunksize=32), dd.from_array(y_, chunksize=32)
reg = xgb.dask.DaskXGBRegressor(n_estimators=4).fit(X, y)
booster = reg.get_booster()
@@ -1405,8 +1405,8 @@ class TestWithDask:
@pytest.mark.skipif(**tm.no_dask())
@pytest.mark.skipif(**tm.no_sklearn())
def test_custom_objective(self, client: "Client") -> None:
from sklearn.datasets import load_boston
X, y = load_boston(return_X_y=True)
from sklearn.datasets import fetch_california_housing
X, y = fetch_california_housing(return_X_y=True)
X, y = da.from_array(X), da.from_array(y)
rounds = 20
@@ -1552,8 +1552,8 @@ class TestWithDask:
assert np.allclose(np.sum(shap, axis=len(shap.shape) - 1), margin, 1e-5, 1e-5)
def test_shap(self, client: "Client") -> None:
from sklearn.datasets import load_boston, load_digits
X, y = load_boston(return_X_y=True)
from sklearn.datasets import fetch_california_housing, load_digits
X, y = fetch_california_housing(return_X_y=True)
params: Dict[str, Any] = {'objective': 'reg:squarederror'}
self.run_shap(X, y, params, client)
@@ -1597,8 +1597,8 @@ class TestWithDask:
1e-5, 1e-5)
def test_shap_interactions(self, client: "Client") -> None:
from sklearn.datasets import load_boston
X, y = load_boston(return_X_y=True)
from sklearn.datasets import fetch_california_housing
X, y = fetch_california_housing(return_X_y=True)
params = {'objective': 'reg:squarederror'}
self.run_shap_interactions(X, y, params, client)