Repository navigation
[TEST] RankData: cross-validate rankdata against scipy.stats.rankdata (#9460) - #9530
Conversation
…OpenMS#9460) The existing sections use tiny hand-computed vectors. This adds a section pinning a larger ties vector and a ties+NaN vector against reference outputs generated with SciPy 1.17.1 -- scipy.stats.rankdata(a, method=, nan_policy=) -- for every tie method (average/min/max/dense/ordinal) and both NaN policies: - propagate: SciPy 1.17.1 returns all-NaN for every method (matches RankData) - omit: rank only the non-NaN values, NaN positions stay NaN Confirmed RankData reproduces SciPy 1.17.1 byte-for-byte across all method x policy combinations before adding the assertions. Verified: builds clean and the test runs PASSED. Co-Authored-By: Claude Opus 4.8 <[email protected]>
|
@timosachsenberg The following names might be missing from the
Please consider applying the following patch: --- AUTHORS 2026-06-15 15:26:58.132415700 +0000
+++ AUTHORS.new 2026-06-15 15:27:03.372235099 +0000
@@ -23,8 +23,8 @@
- Chirag Dave
- Chris Bauer
- Chris Bielow
- - Christie Mathews
- Christian Ehrlich
+ - Christie Mathews
- Clemens Groepl
- Cornelia Friedle
- Daniel Jameson |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughAdds a NaN-aware vector comparison helper ChangesRankData SciPy Cross-Validation Tests
Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
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 |
What
Adds a section to
RankData_testthat pinsRankData::rankdataagainst reference outputs generated with SciPy 1.17.1 (scipy.stats.rankdata(a, method=…, nan_policy=…)):propagate— SciPy 1.17.1 returns all-NaN for every method (whichRankDatamatches);omit— rank only the non-NaN values, NaN positions stay NaN.Why
Closes the §7
[AUTO]gap in the OpenMS 3.6.0 pre-release testing plan (#9460):RankDatadocuments itself as replicatingscipy.stats.rankdata, but the existing tests only used tiny hand-computed vectors and never cross-checked against SciPy. This locks the SciPy-parity contract.Adversarial check
The header comment notes parity with "SciPy 1.16.2 docs". Because
nan_policy='propagate'semantics have historically varied across SciPy versions, I first generated the ground truth on the installed SciPy (1.17.1) and confirmedRankDatareproduces it byte-for-byte across every method × policy (via a standalone compile of the header-only class) before writing any assertion — so the test asserts a real, verified match rather than an assumed one. On 1.17.1,propagateis all-NaN for every method, which agrees withRankData.Test plan
Tests only — no production code changed. Verified locally: SciPy ground-truth generated, standalone match confirmed,
-fsyntax-onlyclean, full build green, test runs PASSED.Part of #9460. Follows #9524, #9525, #9526, #9528.
🤖 Generated with Claude Code
Summary by CodeRabbit