Repository navigation
[FIX] ProteomicsLFQ: actually shuffle the quant-score SVM training sample - #9982
Conversation
…mple The `Math::RandomShuffler` in the quantification-score filter was constructed but never called, so `randomized_indices` was `iota`-filled and iterated in FeatureMap order. The loop caps the SVM training set at 1000 targets and 1000 decoys, which therefore picked the first 1000 of each in RT order rather than a random subsample, biasing training towards early-eluting features. Shuffle the index vector before use. The seed is fixed (42) so the selection stays reproducible across runs -- the previously default- constructed shuffler was already deterministic, this just makes it explicit (same pattern as ProSEAlgorithm). The shuffle is consistent on both sides: predictor/label rows are filled while iterating `randomized_indices`, `SimpleSVM::predict` returns one prediction per observation in row order, and the write-back iterates the same index vector, so row i always maps to fm[randomized_indices[i]]. No test impact: the path is gated on `-feature_with_id_min_score > 0` (default 0.0) and no test or ini enables it. Fixes #9981 Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (1)
Included review availability: Your plan provides up to 4 included reviews per hour; 3 remain after this review. 📝 WalkthroughWalkthroughChangesQuantification-score training selection
Suggested reviewers: Poem
Merge Risk: ⚪ Minimal · up to The change uses a fixed seed to select a randomized subset for quantification-score SVM training while preserving reproducibility and existing interfaces. No actionable merge-blocking risk remains beyond normal checks and review. 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches 💡 1📝 Generate docstrings 💡
🧪 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 |
…fix entry The median-FWHM entry added by OpenMS#9985 was missing its own PR citation. The quant-score SVM training shuffle fix (OpenMS#9981/OpenMS#9982) had no entry at all. Co-Authored-By: Claude Sonnet 5 <[email protected]> Claude-Session: https://claude.ai/code/session_011BcssmGej97WFDdDWW7LhW
Fixes #9981
Problem
In
ProteomicsLFQ's quantification-score SVM filter,Math::RandomShuffler shuffler;was constructed but never called.randomized_indiceswasiota-filled and then iterated inFeatureMaporder:The loop caps the SVM training set at 1000 targets and 1000 decoys, so without the shuffle those were simply the first 1000 of each in
FeatureMap(RT) order, biasing training towards early-eluting features instead of a random subsample.Fix
Shuffle the index vector before use, with an explicit fixed seed:
Same pattern as
FFIDAlgoExternalIDHandler::getRandomSample_, which does exactly this for its SVM training selection.On determinism
The issue flagged that fixing this could make the path non-deterministic. It does not:
RandomShuffler's default ctor is= default, sorng_was already a default-seededboost::mt19937_64. Passing42explicitly just documents that (cf.ProSEAlgorithm.cpp:1123) and keeps the selection reproducible across runs.Index consistency
The shuffle permutes both sides consistently, so there is no row/feature desync:
predictorsandlabelsrows are filled while iteratingrandomized_indices;SimpleSVM::predict(predictions)with an empty index list returns one prediction per observation in row order (src/openms/source/ML/SVM/SimpleSVM.cpp);randomized_indices.So row
iofpredictors/labels/predictionsalways refers tofm[randomized_indices[i]]. A comment in the code records this invariant.Test impact
None. The path is gated on
filter_by_quant_scores, i.e.-feature_with_id_min_score > 0(default0.0). No test or.iniundersrc/tests/orshare/setsfeature_with_id_min_scoreorfeature_without_id_min_score, so all existing reference outputs are produced with this branch disabled.Verified to compile cleanly (
-fsyntax-onlywith the target's real build flags).🤖 Generated with Claude Code
Summary by CodeRabbit