text_plain_output_1.png
"""import xgboost
params = [
    {
        'learning_rate' : [0.2],
        'n_estimators': [250],
        'max_depth': [3],
    },
]
gsc = GridSearchCV(
        estimator=xgboost.XGBRegressor(),
        param_grid=params,
        cv=3,
        scoring='r2', 
        verbose=0, 
        n_jobs=-1)
grid_result = gsc.fit(X_train, Y_train)
print('Best params:', grid_result.best_params_)
print('Best score:', grid_result.best_score_)
xgBoost = xgboost.XGBRegressor(max_depth=3, learning_rate=0.2, n_estimators=250, booster='gbtree')
xgBoost.fit(X_train, Y_train)
print("train score", xgBoost.score(X_train, Y_train))
print("test score", xgBoost.score(X_test, Y_test))
#print("crossVal score", cross_val_score(xgBoost, X, Y, cv=3).mean())"""