[FIX] ASR: apply online recency weights on the euclid path (weighted geometric median)#112
Open
sappelhoff wants to merge 1 commit into
Open
[FIX] ASR: apply online recency weights on the euclid path (weighted geometric median)#112sappelhoff wants to merge 1 commit into
sappelhoff wants to merge 1 commit into
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #112 +/- ##
==========================================
+ Coverage 83.16% 83.22% +0.05%
==========================================
Files 25 25
Lines 2834 2843 +9
==========================================
+ Hits 2357 2366 +9
Misses 477 477 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Collaborator
Author
sappelhoff
force-pushed
the
fix/asr-online-weighting
branch
from
July 13, 2026 17:10
6d752d0 to
0433ac5
Compare
Open
sappelhoff
force-pushed
the
fix/asr-online-weighting
branch
from
July 19, 2026 09:12
eb454b3 to
a7985ed
Compare
…geometric median) Two coupled fixes to the online covariance weighting in ASR.transform(): - The euclid path discarded its recency weights. transform() builds an exponential recency weight vector and passes it to asr_process(sample_weight=...), but on the default method="euclid" path asr_process called geometric_median() with no weights (and the function had no weight parameter), so the weights were computed and silently dropped -- only the riemann branch ever used them. Generalize geometric_median() to an optional sample_weight using the weighted Vardi-Zhang iteration; with sample_weight=None (or all ones) it reduces exactly to the previous unweighted algorithm, so asr_calibrate (which calls it unweighted) is numerically unchanged. Pass sample_weight through the euclid branch of asr_process. - The recency weight vector used prefix sums instead of suffix sums. A block's recency is the number of MORE-RECENT samples that follow it, i.e. the suffix sum of the per-block sample counts; the previous prefix-sum index mis-weighted interior blocks whenever chunk sizes differed. Add a _recency_weights helper that accumulates the suffix sample count newest->oldest; the most recent block keeps weight 1 and older blocks decay toward ~5%. Adds regression tests for the weighted median, the euclid wiring, and the suffix-sum weights.
nbara
force-pushed
the
fix/asr-online-weighting
branch
from
July 20, 2026 13:28
a7985ed to
6d0ab3a
Compare
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.
Two coupled fixes to the online covariance weighting in
ASR.transform():transform()builds an exponential recency weight vector and passes it toasr_process(sample_weight=...), but on the defaultmethod="euclid"pathasr_processcalledgeometric_median()with no weights (and the function had no weight parameter), so the weights were computed and silently dropped — only the riemann branch ever used them. Generalizegeometric_median()to an optionalsample_weightusing the weighted Vardi-Zhang iteration; withsample_weight=None(or all ones) it reduces exactly to the previous unweighted algorithm, soasr_calibrate(which calls it unweighted) is numerically unchanged. Passsample_weightthrough the euclid branch ofasr_process._recency_weightshelper that accumulates the suffix sample count newest→oldest.Testing
Adds regression tests for the weighted median (uniform == unweighted), the euclid wiring, and the suffix-sum weights. Full
tests/test_asr.pypasses;ruffclean.