XGBoostStumpRegressor#
- class XGBoostStumpRegressor(lam, approximation=None, n_quantiles=32, min_cover=1, n_jobs=1)[source]#
Bases:
DecisionTreeStumpRegressorStump of the XGBoost trees (regression): the threshold with the highest XGBoost gain, the similarity score of the two children minus the one of the node.
It is a
Stumpmade of a MatrixTransformer and an XGBoostSplitter, used by RuleTreeXGBoostRegressor, whose target are the residuals of the previous trees.- Parameters:
lam (float) – L2 regularization of the leaf values: the similarity score of a node is
sum(residuals) ** 2 / (n + lam).approximation ({None, 'quantile'}, default=None) – With ‘quantile’, only
n_quantilesthresholds (quantiles) are tested on each numerical feature, instead of all the values.n_quantiles (int, default=32) – Number of thresholds tested with approximation=’quantile’.
min_cover (float, default=1) – Minimum cover (number of instances) of each child.
n_jobs (int, default=1) – Not used.
- Variables:
transformer (MatrixTransformer) – The fitted transformer.
splitter (XGBoostSplitter) – The fitted splitter (feature, threshold, gain and impurity of the split).
data_type (str) – Data type the stump was fitted on.
feature_original (int) – Column of the data used by the split.
threshold_original (float) – Threshold of the split.
See also
RuleTree.tree.RuleTreeXGBoostRegressor.RuleTreeXGBoostRegressorthe tree that uses this stump.
RuleTree.ensemble.XGBoostRegressor.XGBoostRegressorthe boosting of these trees.
Examples
>>> from sklearn.datasets import load_diabetes >>> from RuleTree.stumps.regression import XGBoostStumpRegressor >>> X, y = load_diabetes(return_X_y=True) >>> stump = XGBoostStumpRegressor(lam=1) >>> stump = stump.fit(X, y - y.mean(), context=None, node_id=None, cache=None) # residuals of the mean >>> stump.get_rule()["textual_rule"] 'X_8 <= -0.004'
- property gain#
XGBoost gain of the split, used by the gamma pruning of RuleTreeXGBoostRegressor.