-
-
Notifications
You must be signed in to change notification settings - Fork 25.8k
HistGradientBoosting* interaction constraints #19148
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
One question is on the API. As long as feature names are not available, I guess it would be similar to |
I agree we could allow the same index based constraints specs as for |
Concerning the API. In both lightgbm and xgboost, interaction constraints are specified as nested lists: [[0, 1], [2, 3, 4]] where each inner list is a group of indices of features that are allowed to interact with each other. [[0,1], [1, 3, 4]] It's not well documented, but xgboost (see dmlc/xgboost#7115) and lightgbm (see microsoft/LightGBM#4481) handle this differently:
I propose to implement the choice of LightGBM: constraints are inherited to their childs. |
@thomasjpfan I also started today working on it. Should I share what I have or are you already on the way? The main point of impact seems to be in the function with nogil:
...
for feature_idx in prange(n_features,..): # Here we should only loop over allowed features.
... |
@lorentzenchr Feel free to work on it! Ping me for reviews. :) |
@mayer79 ping |
Super exciting, thanks for working on this! Regarding the interface, a natural way to treat unlisted variables is to consider them as one separate interaction group. A typical application of interaction constraints is to force one or a couple of features to act additively on the prediction, while letting the remaining features interact freely. So, e.g., if there are features 0, 1, 2, 3 and the model should be additive only in feature 0, then we could either specify |
Cross referencing #3482 (comment):
@amueller Sometimes, there are very important things in practice like interaction constraints that are not well investigated in the ivory tower of academic research. @mayer79 Once, you mentioned a reference paper for interaction constraints. Do you still remember? |
@lorentzenchr : this is the first source that I could find when digging into the topic: |
@mayer79 Thank you. A paper that uses more complicated interaction constraints for bundling location related features together is https://dx.doi.org/10.2139/ssrn.3924412. |
BTW, interaction constraints for HGBT are listed on the priorities for 2021 from the Technical Committee, point 3 in https://scikit-learn.fondation-inria.fr/technical-committee-november-5-2020-fr/. |
I also found the paper https://arxiv.org/abs/2007.05758 "Feature Interactions in XGBoost". |
Describe the workflow you want to enable
I'd like to use
HistGradientBoostingClassifier
andHistGradientBoostingRegressor
with the possibility to set interaction constraints for certain features. As said in microsoft/LightGBM#2884 (comment), it is one way to make those black boxes more intuitive and interpretable. In addition, it makes it much more easy to marginalize over those features.Additional context
LightGBM has
interaction_constraints
, see their docs. XGBoost has them, see their docs.Have also a look at the XGBoost tutorial on interaction constraints for a nice visualization and for potential benefits:
The text was updated successfully, but these errors were encountered: