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
validate smoothing window weights are finite before use
scale finite nonnegative weights by their largest entry during construction
preserve relative weights when a direct floating-point sum would overflow
add a backend-aware regression through the public sliding-window smoother API
Root cause
SlidingWindowManifoldMeanSmoother stored raw window_weights and summed them directly both during construction and for each active edge window. Individually finite weights can still have an infinite sum. For example, [finfo.max, finfo.max / 2] has the well-defined ratio 2:1, but direct normalization produces [0, 0]. The subsequent Dirac distribution then rejects the zero-mass weights instead of returning the weighted manifold mean.
Fix
After shape, finiteness, nonnegativity, and positive-mass validation, scale the complete weight vector by its largest entry. The stored values are bounded by one and preserve the original ratios, so all later truncated-window sums remain finite and can be normalized safely.
Validation
reproduced the pre-fix overflow: maximum finite weights sum to inf and direct normalization collapses to zero
verified scale-first normalization preserves the expected 2/3, 1/3 ratio
added a trailing-window regression where states [0, 3] smooth to 1 under extreme 2:1 weights
compared the branch with main: two commits ahead, zero behind; only the smoother implementation and its existing test module changed
The full backend and lint matrix is delegated to GitHub Actions.
📣 MegaLinter 9.5.0 is out! Discover the new features and security recommendations in the release announcement. (Skip this info by defining SECURITY_SUGGESTIONS: false)
Your project could benefit from a custom flavor, which would allow you to run only the linters you need, and thus improve runtime performances. (Skip this info by defining FLAVOR_SUGGESTIONS: false)
Current main already contains a stronger implementation of this fix: window weights are validated as finite/non-negative and every active edge-window slice is scale-normalized through two square-root-sized divisions before summation. That covers the extreme finite-weight overflow addressed here while preserving truncated-window behavior. Closing this now-conflicted branch as superseded rather than reintroducing the older construction-time scaling approach.
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
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.
Summary
Root cause
SlidingWindowManifoldMeanSmootherstored rawwindow_weightsand summed them directly both during construction and for each active edge window. Individually finite weights can still have an infinite sum. For example,[finfo.max, finfo.max / 2]has the well-defined ratio2:1, but direct normalization produces[0, 0]. The subsequent Dirac distribution then rejects the zero-mass weights instead of returning the weighted manifold mean.Fix
After shape, finiteness, nonnegativity, and positive-mass validation, scale the complete weight vector by its largest entry. The stored values are bounded by one and preserve the original ratios, so all later truncated-window sums remain finite and can be normalized safely.
Validation
infand direct normalization collapses to zero2/3, 1/3ratio[0, 3]smooth to1under extreme2:1weightsmain: two commits ahead, zero behind; only the smoother implementation and its existing test module changedThe full backend and lint matrix is delegated to GitHub Actions.