Repository navigation
02: Update RR correction and rhythm screening without replaying settled beats - #104
Draft
mikenrafter wants to merge 22 commits into
Draft
mikenrafter wants to merge 22 commits into
mikenrafter wants to merge 22 commits into
Conversation
Lipponen & Tarvainen (2019), Peltola (2012). The 32-beat cap is an internal ESTIMATE rule, not a published threshold. Include synthetic input recipes and old/new measurements.
Lomb (1976), Scargle (1982), Press & Rybicki (1989). Shift the spectral origin to the first sample before forming trigonometric arguments; pin the unrounded power on synthetic epoch seconds.
Preserve Task Force (1996) and Welch (1967) formulas for finite inputs. Timestamp validity is an implementation guard, preventing endless segment walks and invalid integer conversions.
Nelson et al. (1979), Methods for cosinor-rhythmometry; Welford (1962) centered co-moments. A relative determinant gate replaces the absolute pivot test; preserve upstream significance policy.
Morton, Fitz-Clarke & Banister (1990); Neumaier (1974) compensated summation. Preserve weighting and anchors; pin changed last digits.
Banister et al. (1975); Morton et al. (1990); Neumaier (1974). Preserve EWMA formulas and bounded-prefix priming while matching the arithmetic of the later incremental path.
Karvonen (1957) supports reserve zones only. Duration credit is an internal ESTIMATE rule with low confidence; preserve cadence validation, median capping and tail credit.
Witting (1990); van Someren (1999); Welford (1962). Preserve batch profile sums and first-winner ties; centered variance changes last digits in IS and IV.
Task Force (1996); Welford (1962). Port centered NN, lag and bin moments into batch code and retain shared spectral jitter policy. Rejection and breathing-line exemptions remain internal ESTIMATE rules with low confidence.
Record synthetic old/new observations and freeze twelve batch-only cases before aggregator adoption. Pin unchanged batch timestamp-gap exclusion and circular near-tie selection as controls. Methods and internal-policy limits are documented with the results.
|
Important Draft PR not reviewedDraft PRs are not automatically reviewed by default.
To automatically review draft PRs, update your CodeRabbit configuration: reviews:
auto_review:
drafts: true
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. |
Author
|
@coderabbitai review |
Action not completed
|
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.
Review updates
Inherited the review fixes from #102 and #103, including d059e6e. Added explicit cap-gap stream/restart coverage and rejected cap-only labels in uncapped checkpoints. Frozen pre-cap oracle comparisons explicitly use uncapped APIs; capped-label assertions were strengthened. Dart 3.11.4 analysis clean; full initial fix pass 1,564 passed, 6 existing capture skips. All 60 current output-change cases pass after the follow-ups. This cumulative draft will be rebased and marked ready after its predecessors merge.
Depends on 01 / #103.
Depends on 00 / #102.
This is draft 02 of the split of #99. It targets
main, so its diff is cumulative and includes the preceding branches. Review this area in its final commit; merge the preceding PRs first, then rebase this branch before merging.Correcting RR and screening rhythm again at every sync repeats work on beats whose result has already settled. This adds an ordered corrector and rhythm-screen state that preserve settled evidence and evaluate the unfinished tail separately.
What changes
RrCorrector, settled/tail snapshots and versioned checkpoints.IrregularScreenState, shared window rules and structured diagnostics.Lipponen and Tarvainen 2019 and Peltola 2012 support RR classification/correction. The artifact-run cap and irregular-rhythm classifier remain explicitly internal ESTIMATE rules, not published diagnostic estimators. Gap-spanning pairs are newly excluded from the streaming screen to agree with the parent's gap-aware batch path. Stream SD1/SD2, pNN and votes can therefore change. Older screen checkpoints without previous-beat timestamps are refused. Consumers must account for this output change in Edge's
kAlgoVersionwhen adopting it. Missing evidence stays null.Algebraic breakdown
RrCorrector,_CappedStatefold(rr, tsMs)emits immutableRrSettled;snapshot()corrects the provisional suffix to produceRrSnapshot. Ordered transducer with checkpoint, not a monoid. Uncapped artifact runs can need unbounded context.rr_irregular_laws_test.dartchecks chunk invariance, empty fold, snapshot purity, malformed checkpoints, refusal atomicity and conservation. NN/classes/counts exact; floating values use that file's NaN-aware comparison.RrSettled,RrSnapshotnormal + corrected + dropped == rawandNN == raw - dropped, including provisional contributions.tool/incremental/rr_stream.dartcorrector_Sortedthreshold windows, raw tail, class and timing state; fresh objectIrregularScreenStateevaluateor diagnostics including a temporary open-window vote. Ordered fold, not a commutative monoid.1e-9*max(1,abs(expected)), confidence1e-12*max(1,abs(expected)), with the explicit near-zero SD2 qualification; decoder and wire metadata are exact.irregularWindowConfigOk,irregularWindowVerdictRrCleaningCounts,IrregularThresholds,IrregularWindowCounts,IrregularDiagnostics,IrregularScreenResult, abstention/open-window enumsslidingMedianssliding_median_test.dartcompares to independently clipped/sorted windows, including duplicates/NaN/signed zero. Same type-7 interpolation; no relaxed approximation.A stream's chunk invariance says repeated append transitions equal one append over the concatenated input. It does not establish a
combineoperation. Associativity and commutativity are therefore not claimed for corrector or screen states.Where the performance gains are
Correction reuses settled work and recalculates its unresolved tail. With the configured cap and fixed correction window, append arithmetic depends on new beats plus context; uncapped long runs remain an exception. The screen updates moments and counters for new NN, then evaluates its current window, instead of rescanning all earlier windows. Sliding medians avoid sorting and allocating a new window at every position; insertion/removal still shifts a list and costs O(window length).
No benchmark was rerun. Historical JIT results retained in
docs/COMBINED_BUMP_STATUS.md, arriving in area 6, citetool/bench_night_nn.dart, also arriving there: seed 1, synthetic 24-hour wake/sleep/wake layout, 32 night prefixes at 15-minute intervals. Streaming RR took 61.78 ms total versus 547.87 ms repeated batch. One cold whole-day fold plus snapshot took 210.42 ms versus 174.75 ms batch. These numbers show the repeated-pass benefit and the one-shot cost; they predate later integration changes and are not current split measurements. This branch'stool/incremental/bench_rr.dartmeasures a synthetic real-shaped 23-hour day; no timing from that input is claimed here. Screen and sliding-median gains are not separately measured.Tests
Dart 3.11.4, resolved matcher 0.12.20.
dart analyze: no issues. Fulltimeout 3000 nice -n 10 dart test -j 2 --reporter json: 1,548 passed, 6 skipped, 0 failed. Counts include the inherited suite. Elapsed test time 68.697 seconds.Logs:
areas-logs/area-2.analyze.log,areas-logs/area-2.test.jsonl, exit status files and start/finish timestamps. Skips are optional external fixtures/corpora. No assertion was removed and no tolerance was widened. Dart 3.5.0 itself was not run; final test blobs retain the existing NaN-aware matcher fix.Suggested review order
One commit:
0725b6932e4eRR correction and rhythm screening replay settled beats on each sync. Review the state/empty/combine or append transitions first, the finish/publication rules next, then the area reference/law/checkpoint tests and tools.Change size and stacking
Logic under
lib/: +1,836/-110, 1,946 changed lines. Tests, tools and docs: +7,380/-0, 7,380 changed lines. Other root documentation: +0/-0.Stacks on
split/area-1-frameworkatb5903fd9a9ee. This is branch 2 of 6, one compiled and fully tested commit per branch. Apply the stack in numerical order; the final branch must matchorigin/split/aggregatorsexactly.Questions for the reviewer