Skip to content

4/8 Precision pathways and crissCrossValidate fixes (cumulative costs, honest diagonal) - #129

Merged
DarioS merged 6 commits into
review/3-metrics-plotsfrom
review/4-pathways-crisscross
Oct 28, 2026
Merged

DarioS merged 6 commits into
review/3-metrics-plotsfrom
review/4-pathways-crisscross

Conversation

@ellispatrick

@ellispatrick ellispatrick commented Oct 9, 2026 •

Copy link
Copy Markdown
Member

Part of a stack of 8 pull requests from the October 2026 audit of ClassifyR (AUDIT.md on branch audit-2026-10). Each part is based on the one before, so they need to be merged in order. Each one can be accepted, changed or rejected on its own merits. Draft PR #125 holds all eight together. Every part installs and passes its own tests.

Stack, merge in order: #126 tests and core fixes → #127 interface fixes → #128 metrics and plots → #129 pathways and criss-cross → #130 maintenance → #131 faster cross-validation (identical results) → #132 shared folds (changes results) → #133 release notes. The regression harness and timings are in SydneyBioX/ProjectClassifyR (private).

Summary

Fixes to precision pathways, crissCrossValidate and the parameter classes.

Why and what

Precision pathways:

  • Matching models: models are now matched to classifiers by assay name. They were matched by position, which only worked when the assays happened to sort alphabetically in the same order as the classifiers.
  • Cost: a pathway's cost now counts every tier a sample passed through. A sample sent from clinical to miRNA was charged only for miRNA.
  • Prediction applies the stored fold models directly, instead of re-running cross-validation on the test cohort and stratifying it by its labels. New samples no longer need classes, and Procedure 3's prediction went from about 19 min to 18 s.
  • Cut-off: the confidence cut-off is a minimum (>=), as documented.
  • Robustness:
    • the default mode works for clinical data plus one assay;
    • fixedAssays = NULL and list input work;
    • summary() matches weights by name;
    • assay names containing - work;
    • bubblePlot no longer silently drops pathways below 0.5 accuracy.

crissCrossValidate:

  • Diagonal: the modelTest diagonal leaked test samples into feature selection. On noise it gave balanced accuracy 0.85, where honest CV gives 0.51. It is now each data set's own cross-validation, labelled as such.
  • Features: data sets are restricted to their shared features.
  • TOP is required only when runTOP = TRUE.

Classes:

  • informative errors for one-step classifiers and unknown keywords;
  • SelectParams("none") and plain functions work;
  • TrainParams(balancing = ) is an error pointing to ModellingParams (it was silently ignored);
  • show methods fixed;
  • data documentation corrected.

Do results change?

Yes:

  • Procedure 3 dollar figures change under cumulative costs. For example, clinical-miRNA goes from 8,750 to 8,900 end to end.
  • Pathway confidences change, because prediction uses all fold models.
  • The modelTest diagonal changes.

Evidence

289 tests pass (test-pathways.R, test-crisscross.R, test-classes.R).

Questions

  • Prediction confidence averages all repeat × fold models (deterministic). The alternative is one random fold model per repeat.
  • minAssaySamples at prediction makes one patient's routing depend on the rest of the batch.
  • "Confidence" measures agreement between resampled models, not accuracy.

🤖 Generated with Claude Code

https://claude.ai/code/session_01TfsjwkbDbHkX4kJZNe4ER4

ellispatrick and others added 6 commits October 10, 2026 04:46
…dict with stored models

- .permutations keeps a matrix (drop = FALSE), so clinical plus one assay works in the default mode.
- fixedAssays may be NULL or several assays; list input no longer calls colData().
- Models are named and looked up by assay; prediction uses each result's own predictParams.
- precisionPathwaysPredict predicts every new sample with every stored fold model instead of
  re-splitting the new cohort with runTests; classes of new samples are optional.
- A sample is charged for every tier it passed through (cumulative cost).
- summary() matches weights by name and checks they sum to 1.
- The confidence cut-off is a minimum (>=, with a floating point tolerance).
- Each pathway carries its assay sequence; no strsplit on '-'.
- bubblePlot and strataPlot no longer call theme_set(); bubblePlot keeps pathways below 0.5;
  strataPlot draws the true-class strip as its own layer.
- Fold models drop the forImportance forests, which prediction does not use.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01TfsjwkbDbHkX4kJZNe4ER4
…nly when used

- TOP is required only when runTOP = TRUE.
- Data sets are restricted to shared features (with a message) before training and testing.
- The modelTest diagonal is the crossValidate run on that data set, not a leaky re-test.
- Outcome type is checked for every data set; performanceType is resolved before tuning params.
- Random features use max(nFeatures) when several values are tuned.
- crissCrossPlot no longer attaches the result, labels the diagonal, and returns the plot.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01TfsjwkbDbHkX4kJZNe4ER4
…nctions, show fixes

- PredictParams on a one-step classifier or unknown keyword gives a clear error.
- SelectParams('none') returns NULL; SelectParams accepts plain ranking functions.
- TrainParams(balancing = ) is an error pointing to ModellingParams.
- show methods no longer error on missing characteristics and end lines with newlines.
- Remove the unused misspelled class union; fix the 'higer' typo for AUC.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01TfsjwkbDbHkX4kJZNe4ER4
…orrect source URL

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01TfsjwkbDbHkX4kJZNe4ER4
…ix PredictParams show test

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01TfsjwkbDbHkX4kJZNe4ER4
…n from a saved model

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01TfsjwkbDbHkX4kJZNe4ER4

@DarioS DarioS left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great speed improvements. Confidence is indeed repeated consistency - not accuracy.

@DarioS
DarioS marked this pull request as ready for review October 28, 2026 02:00
@DarioS
DarioS merged commit ac390b5 into review/3-metrics-plots Oct 28, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants