|
39 | 39 | from sklearn.exceptions import DataConversionWarning
|
40 | 40 | from sklearn.exceptions import NotFittedError
|
41 | 41 | from sklearn.dummy import DummyClassifier, DummyRegressor
|
42 |
| -from sklearn.pipeline import make_pipeline |
43 |
| -from sklearn.linear_model import LinearRegression |
44 |
| -from sklearn.svm import NuSVR |
45 | 42 |
|
46 | 43 |
|
47 | 44 | GRADIENT_BOOSTING_ESTIMATORS = [GradientBoostingClassifier,
|
@@ -1381,33 +1378,6 @@ def test_gradient_boosting_with_init(gb, dataset_maker, init_estimator):
|
1381 | 1378 | gb(init=init_est).fit(X, y, sample_weight=sample_weight)
|
1382 | 1379 |
|
1383 | 1380 |
|
1384 |
| -def test_gradient_boosting_with_init_pipeline(): |
1385 |
| - # Check that the init estimator can be a pipeline (see issue #13466) |
1386 |
| - |
1387 |
| - X, y = make_regression(random_state=0) |
1388 |
| - init = make_pipeline(LinearRegression()) |
1389 |
| - gb = GradientBoostingRegressor(init=init) |
1390 |
| - gb.fit(X, y) # pipeline without sample_weight works fine |
1391 |
| - |
1392 |
| - with pytest.raises( |
1393 |
| - ValueError, |
1394 |
| - match='The initial estimator Pipeline does not support sample ' |
1395 |
| - 'weights'): |
1396 |
| - gb.fit(X, y, sample_weight=np.ones(X.shape[0])) |
1397 |
| - |
1398 |
| - # Passing sample_weight to a pipeline raises a ValueError. This test makes |
1399 |
| - # sure we make the distinction between ValueError raised by a pipeline that |
1400 |
| - # was passed sample_weight, and a ValueError raised by a regular estimator |
1401 |
| - # whose input checking failed. |
1402 |
| - with pytest.raises( |
1403 |
| - ValueError, |
1404 |
| - match='nu <= 0 or nu > 1'): |
1405 |
| - # Note that NuSVR properly supports sample_weight |
1406 |
| - init = NuSVR(gamma='auto', nu=1.5) |
1407 |
| - gb = GradientBoostingRegressor(init=init) |
1408 |
| - gb.fit(X, y, sample_weight=np.ones(X.shape[0])) |
1409 |
| - |
1410 |
| - |
1411 | 1381 | @pytest.mark.parametrize('estimator, missing_method', [
|
1412 | 1382 | (GradientBoostingClassifier(init=LinearSVC()), 'predict_proba'),
|
1413 | 1383 | (GradientBoostingRegressor(init=OneHotEncoder()), 'predict')
|
|
0 commit comments