fix: IntervalEncoder average-method window predicate (OR should be AND) - #819
Merged
FBruzzesi merged 1 commit intoAug 29, 2026
Conversation
IntervalEncoder average-method window predicate (OR should be AND)
FBruzzesi
approved these changes
Aug 29, 2026
FBruzzesi
left a comment
Collaborator
There was a problem hiding this comment.
Thanks @AlejandroCoronadoN that indeed seems like a copy-pasting gone wrong + wrong logical operator! Thanks for spotting and fixing it
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.
IntervalEncoder(method="average")never applies the lower bound of its averaging window. In_mk_averagethe predicate is:Since
interval - span < interval + spanalways, the second condition is a subset of the first, so the OR collapses to justxs < (interval + span): there is no lower bound. Every point below the interval (however far) leaks into the weighted average, which biases the smoothed height low.The docstring describes
spanas "the span around the interval" (a symmetric, two-sided window), and the siblingmethod="normal"uses all points weighted by a Gaussian, soaverageis meant to be the hard-windowed version of the same idea. The fix uses AND:Repro with a linear target
y = 2x(the smoothed height at each quantile should track2 * quantile):Added a regression test. The existing
method="average"test only used a constant target, which cannot detect the bias (averaging any subset of a constant array still gives that constant).