Repository navigation
feat(PIPECHO): cap SVM training-set size (max_training_points) - #9669
Conversation
The transfer-FDR SVM trained on every candidate transfer per fold with no upper bound, so the LIBSVM grid search (super-linear in point count, x30 fits) dominated runtime on feature-rich runs. Add PipEcho:max_training_points (default 50000, 0 = unlimited): a deterministic stratified subsample of the TRAINING set only. All decoys and labelled positives are kept; the remaining budget is filled with a score-spread (uniform-stride) sample, so no RNG is used and results stay reproducible. Prediction and the q-values still run over every transfer, so the FDR estimate is unbiased. On the PXD016921 single-cell set (5072 training points/fold) capping to 2000 gave byte-equivalent FDR/leakage (Blank 63 peptides, single-cell 5604) while cutting total wall time 13:49 -> 12:21; the win grows super-linearly with scale. Tests: parameter-contract assertion in PipEchoAlgorithm_test; an FDR-control + sensitivity + determinism check under a small cap in the (slow) realistic test. Co-Authored-By: Claude Opus 4.8 <[email protected]> Claude-Session: https://claude.ai/code/session_016rawZsiVUCJjzyXTqkkrWK
📝 WalkthroughWalkthroughPipEcho now exposes ChangesPipEcho training-point cap
Sequence Diagram(s)sequenceDiagram
participant PipEchoAlgorithm
participant Impl
participant TransferFDRModel
PipEchoAlgorithm->>Impl: provide max_training_points parameter
Impl->>TransferFDRModel: construct with min_decoys and max_training_points
TransferFDRModel->>TransferFDRModel: round() caps training data when enabled
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches📝 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 |
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (3)
src/openms/source/ANALYSIS/MAPMATCHING/PIPECHO/TransferFDRModel.cpp (1)
440-444: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low valueUse
\ninstead ofstd::endlin this new log statement.As per coding guidelines, avoid
std::endland use\ninstead for performance reasons.♻️ Proposed change
- << " acceptors (cutoff value " << cutoff << ")" << std::endl; + << " acceptors (cutoff value " << cutoff << ")\n";🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@src/openms/source/ANALYSIS/MAPMATCHING/PIPECHO/TransferFDRModel.cpp` around lines 440 - 444, The new OPENMS_LOG_INFO statement in TransferFDRModel should use a newline character instead of std::endl. Update the log output in the acceptor group progress message to end with \n rather than flushing the stream, keeping the existing message text and symbols like groups, training, and cutoff unchanged.Source: Coding guidelines
src/tests/class_tests/openms/source/PipEchoAlgorithm_test.cpp (1)
104-104: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low valuePrefer
TEST_TRUEfor the boolean existence check.
p.exists(...)returns a bool, so this is a boolean assertion.♻️ Proposed change
- TEST_EQUAL(p.exists("max_training_points"), true) + TEST_TRUE(p.exists("max_training_points"))As per coding guidelines: "Prefer
TEST_TRUE(expr)andTEST_FALSE(expr)overTEST_EQUAL(expr, true)andTEST_EQUAL(expr, false)for boolean assertions".🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@src/tests/class_tests/openms/source/PipEchoAlgorithm_test.cpp` at line 104, The boolean existence check in the PipEchoAlgorithm test uses TEST_EQUAL with true, but this should be a boolean assertion. Update the assertion around p.exists("max_training_points") to use TEST_TRUE instead, following the existing testing guideline and keeping the check in the same test case.Source: Coding guidelines
src/tests/class_tests/openms/source/PipEchoAlgorithm_realistic_test.cpp (1)
545-568: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low valuePrefer
TEST_TRUE/TEST_FALSEfor the boolean assertions.Lines 545, 547, 548, 550, and 568 assert boolean expressions via
TEST_EQUAL(expr, true).♻️ Proposed change
- TEST_EQUAL(realized <= std::max(3.0 * 0.05, 0.05 + 0.05), true) + TEST_TRUE(realized <= std::max(3.0 * 0.05, 0.05 + 0.05)) // The cap must not collapse the method to "drop everything". - TEST_EQUAL(s.n_transfers > 0, true) - TEST_EQUAL(s.n_correct > 0, true) + TEST_TRUE(s.n_transfers > 0) + TEST_TRUE(s.n_correct > 0) // The q-value filter still respects its own cutoff. - TEST_EQUAL(s.all_q_within_cutoff, true) + TEST_TRUE(s.all_q_within_cutoff)and
- TEST_EQUAL(same, true) + TEST_TRUE(same)As per coding guidelines: "Prefer
TEST_TRUE(expr)andTEST_FALSE(expr)overTEST_EQUAL(expr, true)andTEST_EQUAL(expr, false)for boolean assertions".🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@src/tests/class_tests/openms/source/PipEchoAlgorithm_realistic_test.cpp` around lines 545 - 568, The boolean assertions in the PipEchoAlgorithm_realistic_test case use TEST_EQUAL(..., true) for expressions like realized <= ..., s.n_transfers > 0, s.n_correct > 0, s.all_q_within_cutoff, and same; replace these with the appropriate TEST_TRUE assertions in the existing test block so the checks follow the project’s boolean assertion style guideline.Source: Coding guidelines
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@src/openms/source/ANALYSIS/MAPMATCHING/PIPECHO/TransferFDRModel.cpp`:
- Around line 387-412: The current cap allocation in the subsampling lambda
inside TransferFDRModel::subsample_training is decoy-first and can leave too few
labelled positives, causing predictors_t::train to fail and internal_run() to
fall back to MBR scores. Change the budgeting so positives get a reserved
minimum share before filling with decoys/rest, and keep the stride-based
sampling behavior in append_stride while ensuring both classes remain
sufficiently represented. Use the existing symbols subample_training,
append_stride, and predictors_t::train to locate and adjust the logic.
---
Nitpick comments:
In `@src/openms/source/ANALYSIS/MAPMATCHING/PIPECHO/TransferFDRModel.cpp`:
- Around line 440-444: The new OPENMS_LOG_INFO statement in TransferFDRModel
should use a newline character instead of std::endl. Update the log output in
the acceptor group progress message to end with \n rather than flushing the
stream, keeping the existing message text and symbols like groups, training, and
cutoff unchanged.
In `@src/tests/class_tests/openms/source/PipEchoAlgorithm_realistic_test.cpp`:
- Around line 545-568: The boolean assertions in the
PipEchoAlgorithm_realistic_test case use TEST_EQUAL(..., true) for expressions
like realized <= ..., s.n_transfers > 0, s.n_correct > 0, s.all_q_within_cutoff,
and same; replace these with the appropriate TEST_TRUE assertions in the
existing test block so the checks follow the project’s boolean assertion style
guideline.
In `@src/tests/class_tests/openms/source/PipEchoAlgorithm_test.cpp`:
- Line 104: The boolean existence check in the PipEchoAlgorithm test uses
TEST_EQUAL with true, but this should be a boolean assertion. Update the
assertion around p.exists("max_training_points") to use TEST_TRUE instead,
following the existing testing guideline and keeping the check in the same test
case.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 348b6519-7ebf-4729-895a-322442073308
📒 Files selected for processing (7)
src/openms/source/ANALYSIS/MAPMATCHING/PIPECHO/Impl.cppsrc/openms/source/ANALYSIS/MAPMATCHING/PIPECHO/Impl.hsrc/openms/source/ANALYSIS/MAPMATCHING/PIPECHO/TransferFDRModel.cppsrc/openms/source/ANALYSIS/MAPMATCHING/PIPECHO/TransferFDRModel.hsrc/openms/source/ANALYSIS/MAPMATCHING/PipEchoAlgorithm.cppsrc/tests/class_tests/openms/source/PipEchoAlgorithm_realistic_test.cppsrc/tests/class_tests/openms/source/PipEchoAlgorithm_test.cpp
…ning Review follow-up (#9669): the per-fold training subsample filled the cap decoys-first, so a small max_training_points relative to the decoy count could leave too few labelled positives (below the >4 floor in predictors_t::train), fail the round, and silently fall back to MBR scores -- the opposite of the intended speed-up. Unreachable at the default 50000 but reachable for small advanced values. Split the cap between decoys and positives in proportion to their sizes when the labelled set does not fit, so neither class is starved; the below-cutoff 'rest' still fills any remainder. The common case (whole labelled set fits) is unchanged. Verified the realistic FDR-control test still passes under a small cap (now 62 decoys + 426 positives kept of a 500 budget). Also switch the new boolean test assertions to TEST_TRUE per the coding guideline. Co-Authored-By: Claude Opus 4.8 <[email protected]> Claude-Session: https://claude.ai/code/session_016rawZsiVUCJjzyXTqkkrWK
Codex review of #9669: the proportional decoy/positive split could starve the MINORITY class -- e.g. 13 decoys vs 166k positives at cap 50000 allocates ~3 decoys, below predictors_t::train's >4 floor, disabling the SVM on large decoy-sparse (but FDR-estimable) runs. That is the inverse of the earlier decoys-first concern. Keep the minority class whole (it almost always fits) and give the remaining budget to the majority; split the cap evenly only when both classes individually exceed half of it. Both classes stay viable for any reasonable cap. Also correct the parameter help text, which still claimed both labelled classes are always kept whole. Co-Authored-By: Claude Opus 4.8 <[email protected]> Claude-Session: https://claude.ai/code/session_016rawZsiVUCJjzyXTqkkrWK
There was a problem hiding this comment.
🧹 Nitpick comments (1)
src/openms/source/ANALYSIS/MAPMATCHING/PIPECHO/TransferFDRModel.cpp (1)
460-464: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low valueUse
\ninstead ofstd::endlin this modified log statement.The updated
OPENMS_LOG_INFOends withstd::endl, which forces a flush. As per coding guidelines (Avoid std::endl and use \n instead for performance reasons), prefer\n.♻️ Proposed change
<< groups[i].size() << " acceptors, training on " << training.size() << " of " << full_training_size - << " acceptors (cutoff value " << cutoff << ")" << std::endl; + << " acceptors (cutoff value " << cutoff << ")\n";🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@src/openms/source/ANALYSIS/MAPMATCHING/PIPECHO/TransferFDRModel.cpp` around lines 460 - 464, The updated OPENMS_LOG_INFO statement in TransferFDRModel should avoid forcing a flush with std::endl and use a newline terminator instead. Update the logging line in the PIP-ECHO acceptor group message to end with \n, keeping the rest of the message unchanged, so the logging behavior matches the project guideline and the code path remains in the same TransferFDRModel logic.Source: Coding guidelines
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Nitpick comments:
In `@src/openms/source/ANALYSIS/MAPMATCHING/PIPECHO/TransferFDRModel.cpp`:
- Around line 460-464: The updated OPENMS_LOG_INFO statement in TransferFDRModel
should avoid forcing a flush with std::endl and use a newline terminator
instead. Update the logging line in the PIP-ECHO acceptor group message to end
with \n, keeping the rest of the message unchanged, so the logging behavior
matches the project guideline and the code path remains in the same
TransferFDRModel logic.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 8c661232-ef9e-4b58-8b66-8b64676e466b
📒 Files selected for processing (2)
src/openms/source/ANALYSIS/MAPMATCHING/PIPECHO/TransferFDRModel.cppsrc/openms/source/ANALYSIS/MAPMATCHING/PipEchoAlgorithm.cpp
🚧 Files skipped from review as they are similar to previous changes (1)
- src/openms/source/ANALYSIS/MAPMATCHING/PipEchoAlgorithm.cpp
Documents four PRs that landed on 2026-06-26 after the last CHANGELOG update (#9667): - #9668: fix platform-dependent float formatting in scientific notation - #9669: feat(PIPECHO) cap SVM training-set size (max_training_points) - #9670: fix SimpleSVM constant-predictor crashes in predict()/setup() - #9672: perf PeptideAndProteinQuant O(1) sample-ID lookup (fixes IsobaricWorkflow hang) GitHub Actions version bump (#9673) carries no CHANGELOG entry per the PR author's own checklist. Claude-Session: https://claude.ai/code/session_01JxivySW6RCM1tKbU8H6bfj Co-authored-by: Claude <[email protected]>
Problem
PIP-ECHO's transfer-FDR SVM trains on every candidate transfer per
cross-validation fold, with no upper bound. The training set is ~2/3 of all
acceptors, fed to a LIBSVM grid search (super-linear in point count) across
3 folds × 10 rounds = 30 fits. On runs with many features per run the acceptor
count is large and this grid search dominates runtime (the
reaching max number of iterationsspam, driven by the largeCgrid on noisy data). There was nomechanism to bound it.
Change
Add
PipEcho:max_training_points(default 50000,0= unlimited). When afold's training set exceeds the cap,
round()takes a deterministicstratified subsample of the training set only:
of the below-cutoff targets, so the predictor scaling stays representative.
No RNG is used, so results remain reproducible. The cutoff/labels are computed on
the full set first, and prediction and the q-values still run over every
transfer — so the cap only changes the fitted boundary, never the set of
scored transfers, and the FDR estimate stays unbiased.
Plumbing mirrors the existing
min_decoysparameter(
PipEchoAlgorithm→Impl→TransferFDRModel).Result (PXD016921 single-cell,
fdr=0.01, sequential same-machine)This set yields 5072 training points/fold; capping to 2000 triggers the subsample
on every fold.
max_training_points=0(uncapped)max_training_points=2000Every leakage/sensitivity number is identical (consensus files differ by
227 bytes — different SVM model, same accepted transfers) while wall time dropped
~87 s. Since FFID/alignment/quant are identical between the two runs, that delta
is entirely the SVM step; it grows super-linearly with features per run.
Tests
PipEchoAlgorithm_test: parameter-contract assertion (exists, default 50000) —runs in normal CI.
PipEchoAlgorithm_realistic_test(slow,OPENMS_RUN_SLOW_TESTS=1): anFDR-control + sensitivity + determinism check under a small cap (forces the
subsample path on synthetic ground-truth data). Passes.
Note
Default is 50000 (bounds pathological large runs; leaves typical runs unchanged —
e.g. this dataset's 5072/fold is untouched at the default). Happy to change the
default or set it to
0if you'd prefer current behaviour preserved until avalue is chosen.
🤖 Generated with Claude Code
https://claude.ai/code/session_016rawZsiVUCJjzyXTqkkrWK
Summary by CodeRabbit
New Features
max_training_pointsadvanced setting to cap transfer-FDR SVM training points per cross-validation fold in PipEcho (default:50000;0= unlimited).Tests