An AdaBoost regressor.
An AdaBoost 1
regressor is a meta-estimator that begins by fitting a regressor on the original dataset and then fits additional copies of the regressor on the same dataset but where the weights of instances are adjusted according to the error of the current prediction. As such, subsequent regressors focus more on difficult cases.
This class implements the algorithm known as AdaBoost.R2 2
.
Read more in the :ref:`User Guide <adaboost>`.
.. versionadded:: 0.14
Parameters ---------- base_estimator : object, optional (default=None) The base estimator from which the boosted ensemble is built. If ``None``, then the base estimator is ``DecisionTreeRegressor(max_depth=3)``.
n_estimators : integer, optional (default=50) The maximum number of estimators at which boosting is terminated. In case of perfect fit, the learning procedure is stopped early.
learning_rate : float, optional (default=1.) Learning rate shrinks the contribution of each regressor by ``learning_rate``. There is a trade-off between ``learning_rate`` and ``n_estimators``.
loss : 'linear', 'square', 'exponential'
, optional (default='linear') The loss function to use when updating the weights after each boosting iteration.
random_state : int, RandomState instance or None, optional (default=None) If int, random_state is the seed used by the random number generator; If RandomState instance, random_state is the random number generator; If None, the random number generator is the RandomState instance used by `np.random`.
Attributes ---------- base_estimator_ : estimator The base estimator from which the ensemble is grown.
estimators_ : list of classifiers The collection of fitted sub-estimators.
estimator_weights_ : array of floats Weights for each estimator in the boosted ensemble.
estimator_errors_ : array of floats Regression error for each estimator in the boosted ensemble.
feature_importances_ : ndarray of shape (n_features,) The feature importances if supported by the ``base_estimator``.
Examples -------- >>> from sklearn.ensemble import AdaBoostRegressor >>> from sklearn.datasets import make_regression >>> X, y = make_regression(n_features=4, n_informative=2, ... random_state=0, shuffle=False) >>> regr = AdaBoostRegressor(random_state=0, n_estimators=100) >>> regr.fit(X, y) AdaBoostRegressor(n_estimators=100, random_state=0) >>> regr.feature_importances_ array(0.2788..., 0.7109..., 0.0065..., 0.0036...
) >>> regr.predict([0, 0, 0, 0]
) array(4.7972...
) >>> regr.score(X, y) 0.9771...
See also -------- AdaBoostClassifier, GradientBoostingRegressor, sklearn.tree.DecisionTreeRegressor
References ---------- .. 1
Y. Freund, R. Schapire, "A Decision-Theoretic Generalization of on-Line Learning and an Application to Boosting", 1995.
.. 2
H. Drucker, "Improving Regressors using Boosting Techniques", 1997.