refactor(inference): move covariance arithmetic to Rust - #647
Conversation
|
Warning Review limit reached
Next review available in: 8 minutes You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (7)
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. Comment |
|
@opencode-agent address Exact bounded RED→GREEN implementation handoff for issue #625 / Draft #647. Immediately before any write, refetch exact PR head, independently resolve live protected The intended production-boundary RED is proven on exact CI run Implement only the minimum root-cause fix for this first #625 slice. Move covariance inverse/pseudoinverse and standard-error diagonal reduction/square-root arithmetic into Add complete rustdoc/docstrings, APA-7 doctoring grounded in authoritative numerical/statistical sources as applicable, an authoritative changelog fragment, then render/check managed CHANGELOG after GREEN. Run focused tests before full applicable Python/Rust/PyO3/package/GPU/fuzz/security/SAST gates on one unchanged final head. Do not touch backend #645, fitstats #646, fit.py #642, config #640, serving #638, validation #635, canonical docs #604/#621, dependencies/workflows/version/release. Commit coherent changes, leave Draft, then stop source writes for exact-head maintainer review/Ready/merge. |
|
@jules address Fallback sole branch writer for exact Draft #647 head The intended RED is exact: CI Implement only this first #625 slice: move covariance inverse/pseudoinverse and covariance-diagonal SE arithmetic into |
|
@jules address Supersede the inactive OpenCode implementation handoff The intended production-boundary RED is already exact: CI Implement only the first bounded #625 slice: move After focused GREEN, add complete rustdoc/docstrings, APA-7 doctoring and an authoritative changelog fragment; render/check managed CHANGELOG; run focused then full applicable Python/Rust/PyO3/package/GPU/fuzz/Security/SAST gates on one unchanged head. Do not touch backend #645, fitstats #646, fit.py #642, config #640, serving #638, validation #635, canonical #604/#621 docs, dependencies/workflows/version/release. Keep Draft and stop branch writes after a coherent verified update; review/Ready/merge return to this maintainer loop. |
|
@opencode-agent address Fresh maintainer-loop takeover for exact Draft #647 head The exact production RED is already established: CI Implement only this first bounded #625 ownership slice: move current covariance inverse→Moore–Penrose fallback and standard-error diagonal clamping/square-root arithmetic into Run focused tests first, meaningful changed-production statement/branch coverage/docstrings, then complete applicable Python/Rust/PyO3/package/reinstall/GPU/fuzz/Security/SAST on one unchanged final head. Keep Draft and stop source writes after one coherent verified update; final review/Ready/merge returns to the maintainer loop. Do not widen into finite-difference Hessian construction, second-order eigenanalysis, backend #645, fitstats #646, fit #642, config #640, serving #638, validation #635, dependencies/workflows/version/release, or canonical #604/#621 docs. |
|
@opencode-agent address Fresh current-main reconciliation + GREEN handoff for Draft #647. The previous handoff was explicitly bound to protected Fresh compare is Then implement the minimum first #625 GREEN only: Rust-owned covariance inverse/pseudoinverse and standard-error diagonal reduction/square root, thin PyO3 |
00ef30e to
b2d8eec
Compare
|
@opencode-agent address Exact-current scientific/parity defect on #647 head
out[i] = if d.is_finite() && d > 0.0 { d.sqrt() } else { 0.0 };That is not the protected-main contract Keep #647 unmergeable until a fail-first regression pins this boundary and GREEN either (a) preserves exact existing semantics ( Also revalidate Run focused ownership/parity/uncertainty tests and all same-head gates after repair. Do not widen into observed-information Hessian construction or second-order eigenanalysis. |
|
@opencode-agent address The previously reported invalid-uncertainty defect remains present on exact current head
Execute the already-scoped repair now on this exact head: add fail-first Rust↔Python parity for finite positive/zero/negative/NaN/+Inf diagonals plus non-finite Hessian input; GREEN must either preserve existing non-finite semantics exactly or fail closed consistently with a documented package error, but never coerce invalid/infinite uncertainty to zero. Ensure reports/downstream callers cannot receive false precision. Run focused inference ownership/parity/coverage tests and all same-head gates. Do not widen into observed-information Hessian construction or second-order eigenanalysis. |
Add mlsirm_core::inference for Hessian inversion / pseudoinverse and standard-error extraction; Python wrappers marshal only.
01f7f9c to
363fc12
Compare
Production numerical-ownership gap
Advances #625 with a bounded disjoint first slice. Protected
maina7be9eb8ca0b807364173f8471fc300e3cf9350fstill performs covariance inversion/pseudoinversion and standard-error extraction in Python/NumPy. Those operations directly determine reported parameter uncertainty and therefore belong to the Rust production numerical owner.Intentional RED
Exact fail-first head
00ef30eea93352bcd4c39026aefcb70a590bd33b, directly based on protectedmaina7be9eb8ca0b807364173f8471fc300e3cf9350f.The new production-boundary tests install sentinel compiled-core functions and require:
vcov_from_hessian()to delegate inverse/pseudoinverse arithmetic to_core.vcov_from_hessian; andstandard_errors_from_vcov()to delegate covariance-diagonal clamping/square-root arithmetic to_core.standard_errors_from_vcov.Current protected-main functions use
np.linalg.inv/np.linalg.pinvandnp.sqrt(np.maximum(np.diag(...))), so the sentinel call-count/result assertions are expected to be the only REDs. Setup/import/fixture/changelog failure is not valid RED.Planned minimum GREEN after RED proof
mlsirm-core: square-matrix validation at the binding boundary, inverse with Moore-Penrose fallback using the existingrcondcontract, symmetric returned covariance, and non-negative-diagonal square-root SE behavior.vcov_from_hessianandstandard_errors_from_vcoventrypoints; Python validates/marshals/reshapes only and fails closed if compiled capability is absent.observed_information()finite-difference Hessian construction orsecond_order_test()eigenanalysis; those remain separately sequenced within architecture: migrate observed-information and covariance numerics from Python to Rust #625.Writer boundary
This branch changes only inference covariance/SE ownership and is disjoint from active backend #645, fitstats #646,
fit.py#642,config.py#640, serving #638, validation #635 and canonical docs #604. Keep Draft until RED→GREEN history, exact-head review and repository policy are satisfied.