feat(core): own reusable covariance standardization - #1721
Closed
seonghobae wants to merge 4 commits into
Closed
Conversation
Contributor
|
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: trueThanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
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.
Superseded
Closed unmerged in favor of #1722. Both PRs implement issue #1720 from the same protected-main base, but #1722 removes the undocumented binary64 tolerances and correlation clamping present on this branch. Before closing this lane, #1722 also preserved this PR's unique external public-contract evidence: the exact
fast_mlsirm.covariance_standardization@1.0.0identity, scalar scale-invariance and fail-closed admission, known matrix recovery, multiplicative scale invariance, and malformed-input coverage. The numerical heuristics from this branch are intentionally not carried forward.Closes #1720 only through the surviving #1722 lane; this PR itself is not merged and supplies no predecessor-head gate evidence.
Closes #1720.
Canonical-owner repair
TEPP #475 currently places scalar covariance standardization inside
psychometric_core::event_time, although the arithmetic is reusable static psychometric computation. This PR moves the canonical numerical ownership tomlsirm-core; TEPP retains event-time admission and temporal composition through an adapter after a released version exists.No TEPP type, clock, state equation, provider API, database contract, or product-specific model name is imported here.
TDD lineage
738d3e5e7aa63b75f664fd17d9f422441bfa65e6: external crate tests require a versionedcovariance_standardizationpublic contract before the module exists. They require scalar scale invariance, known matrix recovery, multiplicative scale invariance, and typed fail-closed malformed inputs.e2ec9e8766b3dec46f4d4db9665b34849c3baf2e+6d7fcc264036aa9e2b89d07292bed1403c6cd129: implement and expose the domain-neutral Rust kernel.f811b42631abed273d767841696887832f5159e2.The hosted exact-current-head jobs remain landing authority; the source-level RED commit is preserved lineage, not a claim that hosted CI executed on that failing commit.
Numerical contract
fast_mlsirm.covariance_standardization@1.0.0exposes:standardize_variance(v)for finitev > 0, evaluating(v / sqrt(v)) / sqrt(v)rather than hard-coding 1;standardize_covariance_matrix(Σ, n)for row-major symmetric covariance input, implementingD^{-1/2} Σ D^{-1/2};External tests span
f64::MIN_POSITIVEthroughf64::MAX, a known 2x2 result, 1e100 scale invariance and malformed numeric inputs.Research boundary
Driver, Oud, & Voelkle (2017), DOI 10.18637/jss.v077.i05, and the associated ctsem standardization path provide the motivating TEPP use case. The generic covariance-to-correlation identity is owned here; ctsem names and EventTime semantics are deliberately excluded.
Downstream migration gate
TEPP must not consume this PR head as a production dependency. After this contract is merged and released/versioned, TEPP can replace #475's duplicate static arithmetic with an EventTime adapter and parity tests against the preserved TIPREDVARstd fixtures. Until then #475 remains non-production migration evidence.
Protected base at creation:
main@45627700c26c29bca150896a9519a9b7426acb56.Exact head at creation:
f811b42631abed273d767841696887832f5159e2.No self-approval, protection bypass, or predecessor-head evidence transfer.