Skip to content

RFC Unify old GradientBoosting estimators and HGBT #27873

Open

Description

@lorentzenchr

Current situation

We have the unfortunate situation to have 2 different versions of gradient boosting, the old estimators (GradientBoostingClassifier and GradientBoostingRegressor) as well as the new ones using binning and histogram strategies similar to LightGBM (HistGradientBoostingClassifier and HistGradientBoostingRegressor).

This makes advertising the new ones harder, e.g. #26826, and also result in a larger feature gap between those two.
Based on discussions in #27139 and during a monthly meeting (maybe not documented), I'd like to call for comments on the following:

Proposition

Unify both types of gradient boosting in a single class, i.e. the old names GradientBoostingClassifier and make them switch the underlying estimator class based on a parameter value, e.g. max_bins (None->old classes, integer->new classes).

Note that binning and histograms are not the only difference.

Comparison

Algorithm

The old GBT uses Friedman gradient boosting with a line search step. (The lines search sometimes, e.g. for log loss, uses a 2. order approximation and is therefore, sometimes, called "hybrid gradient-Newton boosting"). The trees are learned on the gradients. A tree searches for the best split among all (veeeery many) split candidates for all features. After a single tree is fit, the terminal node values are re-computed which corresponds to a line search step.

The new HGBT uses a 2. order approximation of the loss, i.e. gradients and hessians (XGBoost paper, therefore sometimes called Newton boosting). In addition, it bins/discretizes the features X and uses a histogram of gradients/hessians/counts per feature. A tree then searches for the best split candidate, but there are only n_features * n_bins candidates (muuuuch less than in GBT).

estimator trees train on node values (consequence of tree train) features X
GBT gradients recomputed in lines search use as is
HGBT gradients/hessians sum(gradient)/sum(hessian) bin/discretize

In fact, one could use 2. order loss (gradients and hessians) without binning X, and vice-versa, use binning with fitting trees on gradients (without hessians).

Parameters

HistGradientBoostingRegressor GradientBoostingRegressor Same Comment
loss loss ✅
quantile alpha ❌
learning_rate learning_rate ✅
max_iter n_estimators ❌ #12807 (comment)
max_leaf_nodes max_leaf_nodes ✅
max_depth max_depth ✅
min_samples_leaf min_samples_leaf ✅
l2_regularization ⛔ ❌
max_features max_features ✅
max_bins ⛔ (nonsense) ❌
categorical_features ⛔ ❌
monotonic_cst ⛔ ❌ #27305
interaction_cst ⛔ ❌ #33278
warm_start warm_start ✅
early_stopping ⛔ ❌
scoring ⛔ ❌
validation_fraction validation_fraction ✅
n_iter_no_change n_iter_no_change ✅
tol tol ✅
verbose verbose ✅
random_state random_state ✅
class_weight ⛔ ❌
⛔ subsample ❌ #16062
⛔ (nonsense) criterion ❌ deprecated, will be remove in 1.11
⛔ min_samples_split ❌
⛔ min_weight_fraction_leaf ❌
⛔ min_impurity_decrease ❌
⛔ init ❌ #27109
⛔ ccp_alpha ❌

In fact, only the quantile/alpha and max_iter/n_estimator parameters are conflicting.

Attributes

Comparing HistGradientBoostingRegressor between GradientBoostingRegressor

  • Replace feature_importances_ with get_feature_importances and document it's bias
  • Define a estimators_ for HGBT
  • Do not need oob if there is no subsample
  • Early stopping: Add fit(..., X_val=None, y_val=None, sample_weight_val=None) with GradientBoostingRegressor

Activity

  1. added
    Needs Triage
    on Nov 29, 2023
  2. added and removed
    Needs Triage
    on Nov 29, 2023
  3. adrinjalali commented on Dec 5, 2023

    @adrinjalali
    Member

    This seems like a somewhat painful path (deprecation-wise), but I think we can greatly benefit from it. So I'm overall +1.

  4. glevv commented on Dec 6, 2023

    @glevv
    Contributor

    About first and second order optimizations, I think catboost has an interesting take on it, where you can select an optimizer order by setting leaf_estimation_method to {Newton, Gradient, Exact}.

    Tthis will be a huge refactoring and documentation rewriting. From the user standpoint, it is really frustrating when a lot of parameter interactions are not documented: you set one parameter and it will actually change available options of other parameters and you will never know this until you try (catboost is actually a great example of such behaviour).

    Also about HGBM: I think there are some features missing that make it a bit less appealing than XGBoost or LightGBM, for example subsampling (of samples and features).

  5. betatim commented on Dec 7, 2023

    @betatim
    Member

    I support the idea of making HistGradientBoosting* available as GradientBoosting*, and therefore the default. Our best "product" should be available at the prime location of our shop (aka name), not hidden under the counter. I think the proposed method of using the value of n_bins to choose between the two is the best idea so far for how to do this. But it does require significant effort and a few deprecation cycles :-/ c'est la vie.

    I can see that by switching (massively?) the algorithm that you get based on a constructor argument you can create confusion. However, I wonder how many people who use gradient boosting actually care about the precise algorithm. I'd include people who can't explain the differences between the two in the category of "don't care" (this includes me).


    Having both versions available under a dedicated name, say, HistGradientBoosting* and ExactGradientBoosting* (?) could be nice for people who want to be super explicit. You could take this idea further by offering more classes that use an estimator but hardwire some of the constructor arguments. The goal would be to make it simpler for users (dealing with the forest of constructor args) and increase discoverability. A downside would be a proliferation of class names. But this is going off-topic.

  6. amueller commented on Jan 22, 2024

    @amueller
    Member

    We switch the algorithm with a constructor parameter in many models, right (for good or bad)?
    I think unification would be nice, but painful and laborious.

    @glevv the subsampling of features and samples could be achieved with a BaggingClassifier around it, right? but I guess that's not entirely the same thing. Both of these would be quite easy to add, I think we just didn't want to explode the number of hyper-parameters.
    I think dropping the tree pruning parameters from GradientBoostingRegressor wouldn't be too bad, I don't think anyone in their right mind uses anything but max_depth or max_leaf_nodes.

  7. betatim commented on Mar 11, 2024

    @betatim
    Member

    An idea I had relating to this issue: what do people think of a small tool that transforms user's code? It could either be an automatic tool that makes the required edits or maybe more like a linter that points you to things that you should investigate. Taking it one step further, a linter for your scikit-learn usage would be cool. It could point out transformations you could make, anti-patterns, etc

  8. adrinjalali commented on Apr 9, 2024

    @adrinjalali
    Member

    If we do such a tool, I think it'd be nice to have it a collaboration between a bunch of other projects in the pydata/scipy space.

  9. betatim commented on Apr 9, 2024

    @betatim
    Member
  10. moved this to Discussion in Tree-based modelson Nov 13, 2025
  11. moved this to Todo - High Priority in Labson Dec 11, 2025
  12. moved this from Todo - High Priority to Todo in Labson Feb 9, 2026
  13. lorentzenchr commented on Jun 12, 2026

    @lorentzenchr
    MemberAuthor

    Which parameter do we settle on for max_iter vs n_estimators? The reason for HGBT to have max_iter is that for muliclass you have n_classes * max_iter trees, so n_estimators gives the wrong impression. Also, the predictor trees are not exposed as scikit-learn estimators.

    What the others do: LightGBM just exposes 100 aliases (num_iterations, num_iteration, n_iter, num_tree, num_trees, num_round, num_rounds, nrounds, num_boost_round, n_estimators, max_iter). XGBoost uses num_boost_round in its own API and n_estimators in its scikit-learn API.

  14. betatim commented on Jun 22, 2026

    @betatim
    Member

    I have no strong opinion, slight preference for max_iter? It feels more "correct" as you point out there might be more trees than you configure and in the case of early stopping there might be less trees.

    But I also find n_estimators nice because that is conceptually how I think about the algorithm, even if we never reach the number of trees or because for multi-class there are N times as many trees.

    I don't like having aliases.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions