diff --git a/tests/python/test_with_sklearn.py b/tests/python/test_with_sklearn.py index 7fd3c88cc..067b166af 100644 --- a/tests/python/test_with_sklearn.py +++ b/tests/python/test_with_sklearn.py @@ -42,5 +42,16 @@ def test_boston_housing_regression(): labels = y[test_index] assert mean_squared_error(preds, labels) < 9 +def test_parameter_tuning(): + boston = load_boston() + y = boston['target'] + X = boston['data'] + xgb_model = xgb.XGBRegressor() + clf = GridSearchCV(xgb_model, + {'max_depth': [2,4,6], + 'n_estimators': [50,100,200]}, verbose=1) + clf.fit(X,y) + assert clf.best_score_ < 0.7 + assert clf.best_params_ == {'n_estimators': 100, 'max_depth': 4}