text_plain_output_1.png
from sklearn import ensemble

import sklearn
sklearn_boost = ensemble.GradientBoostingRegressor(loss='ls', learning_rate=0.1, n_estimators=100)
sklearn_boost.fit(X_train, Y_train)

import sklearn
params = {'learning_rate': [0.05], 'n_estimators': [200], 'max_depth': [6]}
gsc = GridSearchCV(estimator=ensemble.GradientBoostingRegressor(), param_grid=params, cv=3)
grid_result = gsc.fit(X_train, Y_train)
print('Best params:', grid_result.best_params_)
print('Best score:', grid_result.best_score_)
sklearn_boost = ensemble.GradientBoostingRegressor(loss='ls', learning_rate=0.1, n_estimators=200, max_depth=6)
sklearn_boost.fit(X_train, Y_train)
print('train score', sklearn_boost.score(X_train, Y_train))
print('test score', sklearn_boost.score(X_test, Y_test))