perf(linalg): scores-based one-way Bell-McCaffrey DOF denominator#668
Conversation
PR Review ReportOverall Assessment✅ Looks good — no unmitigated P0/P1 findings. Executive Summary
MethodologyFinding M1 — P3 informational, documented deviation / no action required
Code QualityNo findings.
PerformanceNo findings.
MaintainabilityNo findings.
Tech DebtNo findings.
SecurityNo findings.
Documentation/TestsFinding D1 — P3 minor documentation mismatch
Verification note: I could not run the targeted tests in this environment because |
|
🔁 AI review rerun (requested by @igerber) Head SHA: Overall Assessment✅ Looks good — no unmitigated P0/P1 findings. Executive Summary
MethodologyFinding M1 — P3 informational, documented deviation / no action required
Code QualityNo findings.
PerformanceNo findings.
MaintainabilityNo findings.
Tech DebtNo findings.
SecurityNo findings.
Documentation/TestsNo unmitigated findings.
Verification note: |
The non-clustered unweighted BM DOF computed a'(MoM)a against an
explicit dense M = I - H (O(n^2 k) hat build; ~20 GB at n=50k,
documented "practical for n < 10k"). The Schur-product expansion
den = sum_i a_i^2 (1 - 2 h_ii) + tr((B S_a)^2), S_a = X' diag(a) X
is exact algebra ((MoM)_{il} = delta_{il}(1-2h_ii) + (x_i'B x_l)^2):
O(n k^2 + k^3) per contrast, n=50k/k=20 in ~16 ms. Frozen dense-oracle
parity at rtol 1e-10 (basic/high-leverage/k40 + compound contrast);
R-anchored hc2_bm goldens pass unchanged.
New noise-floor cancellation guard: the dense den >= 0 exactly (MoM is
PSD by the Schur product theorem) but the expanded difference can
collapse below float precision on extreme-leverage contrasts; such
denominators now NaN instead of inflating the DOF arbitrarily (the
same failure mode the clustered scores path guards; the prior dense
den > 0 kept them).
Deletes the one-way TODO row (#656's follow-up). Completes the
scores-evaluation family: clustered CR2-BM (#656), low-rank A_g (#664),
one-way (this PR).
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Lbd6nqWmg4snvvBmegwqiw
…ry contrasts finite Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Lbd6nqWmg4snvvBmegwqiw
…dition Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Lbd6nqWmg4snvvBmegwqiw
d271525 to
6395260
Compare
|
🔁 AI review rerun (requested by @igerber) Head SHA: Overall Assessment✅ Looks good — no unmitigated P0/P1 findings. Executive Summary
MethodologyFinding M1 — P3 informational, documented deviation / no action required
Code QualityNo findings.
PerformanceNo findings.
MaintainabilityNo findings.
Tech DebtNo findings.
SecurityNo findings.
Documentation/TestsNo unmitigated findings.
Verification note: a direct numerical smoke check could not run because importing |
Summary
a'(M∘M)awas evaluated against an explicit denseM = I − H(O(n²k)hat build; ~20 GB at n=50k, documented "practical for n < 10k"). The Schur-product expansionΣ a_i²(1−2h_ii) + tr((B·S_a)²)withS_a = X'diag(a)X(k×k) is exact algebra —(M∘M)_{il} = δ_{il}(1−2h_ii) + (x_i'Bx_l)²— costingO(nk² + k³)per contrast with non×nallocation: n=50k/k=20 in ~16 ms.den > 0kept.A_g(perf(linalg): low-rank factored CR2-BM adjustment operators (8-108x) #664), one-way (this PR). Deletes the one-way TODO follow-up row.Methodology references (required if estimator / math changes)
Validation
tests/test_linalg.py::TestOneWayBMScoresDOF— frozen dense-oracle parity at rtol 1e-10 (basic / high-leverage / k=40 + compound contrast) + a guard-firing regression (leverage-1 dummy NaNs, ordinary contrasts finite).test_linalg.py,test_linalg_hc2_bm.py(R-anchored goldens unchanged), andtest_estimators_vcov_type.pypass.Security / privacy
Generated with Claude Code