class sklearn.ensemble.GradientBoostingRegressor(loss=’ls’, learning_rate=0.1, n_estimators=100, subsample=1.0, criterion=’friedman_mse’, min_samples_split=2, min_samples_leaf=1, min_weight_fraction_leaf=0.0, max_depth=3, min_impurity_decrease=0.0, min_impurity_split=None, init=None, random_state=None, max_features=None, alpha=0.9, verbose=0, max_leaf_nodes=None, warm_start=False, presort=’auto’, validation_fraction=0.1, n_iter_no_change=None, tol=0.0001)
[source]
Gradient Boosting for regression.
GB builds an additive model in a forward stagewise fashion; it allows for the optimization of arbitrary differentiable loss functions. In each stage a regression tree is fit on the negative gradient of the given loss function.
Read more in the User Guide.
Parameters: 


Attributes: 

See also
DecisionTreeRegressor
, RandomForestRegressor
The features are always randomly permuted at each split. Therefore, the best found split may vary, even with the same training data and max_features=n_features
, if the improvement of the criterion is identical for several splits enumerated during the search of the best split. To obtain a deterministic behaviour during fitting, random_state
has to be fixed.
J. Friedman, Greedy Function Approximation: A Gradient Boosting Machine, The Annals of Statistics, Vol. 29, No. 5, 2001.
T. Hastie, R. Tibshirani and J. Friedman. Elements of Statistical Learning Ed. 2, Springer, 2009.
apply (X)  Apply trees in the ensemble to X, return leaf indices. 
fit (X, y[, sample_weight, monitor])  Fit the gradient boosting model. 
get_params ([deep])  Get parameters for this estimator. 
predict (X)  Predict regression target for X. 
score (X, y[, sample_weight])  Returns the coefficient of determination R^2 of the prediction. 
set_params (**params)  Set the parameters of this estimator. 
staged_predict (X)  Predict regression target at each stage for X. 
__init__(loss=’ls’, learning_rate=0.1, n_estimators=100, subsample=1.0, criterion=’friedman_mse’, min_samples_split=2, min_samples_leaf=1, min_weight_fraction_leaf=0.0, max_depth=3, min_impurity_decrease=0.0, min_impurity_split=None, init=None, random_state=None, max_features=None, alpha=0.9, verbose=0, max_leaf_nodes=None, warm_start=False, presort=’auto’, validation_fraction=0.1, n_iter_no_change=None, tol=0.0001)
[source]
apply(X)
[source]
Apply trees in the ensemble to X, return leaf indices.
New in version 0.17.
Parameters: 


Returns: 

feature_importances_
Returns: 


fit(X, y, sample_weight=None, monitor=None)
[source]
Fit the gradient boosting model.
Parameters: 


Returns: 

get_params(deep=True)
[source]
Get parameters for this estimator.
Parameters: 


Returns: 

n_features
DEPRECATED: Attribute n_features was deprecated in version 0.19 and will be removed in 0.21.
predict(X)
[source]
Predict regression target for X.
Parameters: 


Returns: 

score(X, y, sample_weight=None)
[source]
Returns the coefficient of determination R^2 of the prediction.
The coefficient R^2 is defined as (1  u/v), where u is the residual sum of squares ((y_true  y_pred) ** 2).sum() and v is the total sum of squares ((y_true  y_true.mean()) ** 2).sum(). The best possible score is 1.0 and it can be negative (because the model can be arbitrarily worse). A constant model that always predicts the expected value of y, disregarding the input features, would get a R^2 score of 0.0.
Parameters: 


Returns: 

set_params(**params)
[source]
Set the parameters of this estimator.
The method works on simple estimators as well as on nested objects (such as pipelines). The latter have parameters of the form <component>__<parameter>
so that it’s possible to update each component of a nested object.
Returns: 


staged_predict(X)
[source]
Predict regression target at each stage for X.
This method allows monitoring (i.e. determine error on testing set) after each stage.
Parameters: 


Returns: 

sklearn.ensemble.GradientBoostingRegressor
© 2007–2018 The scikitlearn developers
Licensed under the 3clause BSD License.
http://scikitlearn.org/stable/modules/generated/sklearn.ensemble.GradientBoostingRegressor.html