You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
QoL improvement: Add monotonicity constraints specification using dict of feature names in HistGradientBoostingClassifier/Regressor #21961
As of current version, we need to specify monotonicity constraints for each feature as an array-like object ( e.g. [0,1,1] ) in HistGradientBoostingClassifier/Regressor. It would be a good quality of life improvement if we can specify the constraint as dict (e.g. {"feature_name1":0, "feature_name2":1 ...}) if the input X is a dataframe.
Make the following changes inside fit function for HistGradientBoostingClassifier/Regressor:
Change input type for monotonic_cst to array-like or dict.
If constraint is specified as a dict, add a validation check for verifying if X is a dataframe with string column names.
Iterate through column names in X, add constraint if specified in the dict to array-like object or add default value if no constraint is specified explicitly. Return array-like object in place of original dict.
Describe alternatives you've considered, if relevant
Activity
Created additional way to specify monotonicty constraint in HistGradi…
lorentzenchr commentedon Mar 28, 2026
This was implemented in #24855, released in 1.2.
#24852 is actually a duplicate of this issue 😄