Add per-feature smoothing_rounds support (#626)#672
Open
ugbotueferhire wants to merge 2 commits into
Open
Conversation
Extend smoothing_rounds and interaction_smoothing_rounds to accept a sequence of ints, one per term, in addition to the existing scalar form. Per Paul's spec on the issue thread: the smoothing phase as a whole runs while any term still has rounds remaining; a term whose counter has reached zero falls back to normal gain-based updates for the remaining smoothing iterations. * _boost.py: replace the scalar smoothing_rounds counter with a per-term np.int64 array. Scalars are broadcast at the top of the loop, so the inner control flow is uniform. The RandomSplits flag, the make_progress predicate, the early-stopping skip, and the end-of-cycle decrement all become per-term checks. * _ebm.py: validate int | Sequence[int] in _normalize_smoothing_rounds. At the mains call site, gather the per-feature list down to the post-exclude term_features order. At the interactions call site, only accept a list when interactions is an explicit list (FAST-discovered interactions cannot be aligned to a user-supplied per-interaction parameter), and align via boost_groups_user_idx to handle dedup. * Update docstrings on ExplainableBoostingClassifier/Regressor and document that DP-EBM ignores the list form. Tests cover scalar/list equivalence, per-feature zero disables smoothing for those features without breaking other features' smoothing, exclude alignment, validation errors (wrong length, negatives, non-integers, empty), and the interactions-list constraint. Signed-off-by: ugbotueferhire <ugbotueferhire@gmail.com>
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #672 +/- ##
==========================================
+ Coverage 67.20% 67.46% +0.25%
==========================================
Files 77 77
Lines 11735 11796 +61
==========================================
+ Hits 7887 7958 +71
+ Misses 3848 3838 -10
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Codecov flagged the validation helper's defensive branches as untested. Add tests for: None input (treated as 0), float scalar (accepted when integer-valued, rejected when fractional or negative), 2D array, object- dtype array, unsupported type (set), per-feature list with exclude='mains' (empty term_features path), and explicit interactions all excluded (empty boost_groups path). Signed-off-by: ugbotueferhire <ugbotueferhire@gmail.com>
Contributor
Author
|
hello @paulbkoch how are you doing, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Extend smoothing_rounds and interaction_smoothing_rounds to accept a sequence of ints, one per term, in addition to the existing scalar form. Per Paul's spec on the issue thread: the smoothing phase as a whole runs while any term still has rounds remaining; a term whose counter has reached zero falls back to normal gain-based updates for the remaining smoothing iterations.
Tests cover scalar/list equivalence, per-feature zero disables smoothing for those features without breaking other features' smoothing, exclude alignment, validation errors (wrong length, negatives, non-integers, empty), and the interactions-list constraint.