XGBoostRegressor#
- class XGBoostRegressor(base_estimator=None, n_estimators=100, learning_rate=0.3, loss='squared_loss', patience=5, val_size=0.15, random_state=42)[source]#
Bases:
GBoostRegressorGradient boosting for regression with the trees of XGBoost (RuleTreeXGBoostRegressor): the splits maximize the XGBoost gain and the leaves predict the regularized XGBoost values.
- Parameters:
base_estimator (RuleTreeXGBoostRegressor, default=None) – Tree fitted at each iteration. If None, RuleTreeXGBoostRegressor with the XGBoost stumps and as many jobs as CPUs, built at fit time.
learning_rate (float, default=0.3) – Shrinkage of the contribution of each tree.
n_estimators – As in GBoostRegressor.
loss – As in GBoostRegressor.
patience – As in GBoostRegressor.
val_size – As in GBoostRegressor.
random_state – As in GBoostRegressor.
- Variables:
base_prediction (float) – Initial prediction (mean of the target).
estimators (list of RuleTreeXGBoostRegressor) – Fitted trees.
See also
RuleTree.tree.RuleTreeXGBoostRegressor.RuleTreeXGBoostRegressorthe base tree.
GBoostRegressorthe same boosting with any RuleTreeRegressor.
Examples
>>> from sklearn.datasets import load_diabetes >>> from RuleTree.ensemble.XGBoostRegressor import XGBoostRegressor >>> from RuleTree.stumps.regression import XGBoostStumpRegressor >>> from RuleTree.tree.RuleTreeXGBoostRegressor import RuleTreeXGBoostRegressor >>> X, y = load_diabetes(return_X_y=True) >>> tree = RuleTreeXGBoostRegressor(max_depth=2, lam=1, base_stumps=XGBoostStumpRegressor(lam=1)) >>> model = XGBoostRegressor(base_estimator=tree, n_estimators=10).fit(X, y) >>> round(model.score(X, y), 3) 0.569