Repository navigation
1/8 Tests and fixes to the cross-validation driver, train/predict and prepareData - #126
Merged
Merged
Conversation
…le Packaged field Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01TfsjwkbDbHkX4kJZNe4ER4
- crossValidate passes selectionMethod on for MultiAssayExperiment and list input. - Parallel parameters are chosen by .Platform.type, so macOS honours nCores and the seed. - extraParams are applied to each stage by one helper; a tuneParams list is tuned rather than passed on as a setting, and tuning ranges without a tuning mode are an error. - Tuning keeps the user's other training settings; nested CV tuning of classifier parameters works. - train() fits each model with runTest, as runTests fits its final model, for one or several assays and for merge, prevalidation and PCA; predict() names new data as train() does and gives each model the features it was trained with. - runTest: the MultiAssayExperiment method works; prepared training data is used for survival too. - Feature importance uses the cross-validation's performance type. - Percentage splits use the outcome given (and balance events for survival); nFeatures = 1 works. - prepareData: topNvariance and maxSimilarity work; the clinical-features warning can fire. - The kNN keyword works. - Tests for each of these in tests/testthat/test-core.R. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01TfsjwkbDbHkX4kJZNe4ER4
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01TfsjwkbDbHkX4kJZNe4ER4
This was referenced Oct 9, 2026
Merged
DarioS
marked this pull request as ready for review
October 27, 2026 22:45
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
A testthat suite, and fixes to the cross-validation driver,
train/predictandprepareData.Why
The package had no tests, and the audit found settings that were silently ignored and code paths that fail on any input. In particular:
crossValidateignoredselectionMethodfor MultiAssayExperiment and list input."Darwin"), sonCoresand the seed were ignored there.train()failed for more than one assay and for merge, prevalidation and PCA.What changes
tests/testthat: smoke tests that run every classifier and selection keyword, plus a test for each fix below. XGB is added to the smoke tests in part 2, with its xgboost 3 fix.selectionMethodon for MultiAssayExperiment and list input;.Platform$OS.type;extraParamswith one helper (replacing two hand-copied loops with a copy-paste bug). AtuneParamslist is now tuned rather than passed to the classifier as a setting, and tuning ranges without a tuning mode are an error instead of being ignored.performances()→performance()).runTest, asrunTestsfits its final model. This works for one or several assays and for merge, prevalidation and PCA.predictnames new data astraindoes and gives each model the features it was trained with.classesobject if one existed);nFeatures = 1works;prepareData'stopNvariance(typounqiue) andmaxSimilarity(did nothing) work;Packaged: 2014field is removed.Do results change?
No, for inputs that worked before. The regression harness (18 seeded scenarios covering every keyword and the protocol's four procedures) gave identical results to
devel. Results change only where a setting used to be ignored, e.g. a non-defaultselectionMethodwith MultiAssayExperiment input.Evidence
70 tests pass.
How to review
R/crossValidate.R:.applyStageExtras, the guard inCV,train.DataFrame,predict.trainedByClassifyR.R/runTest.R,R/utilities.R(.doTrain,samplesSplits),R/prepareData.R.tests/testthat/test-core.Rhas one test per fix.Questions
nFeaturesis tuned by resubstitution. Classifiers that fit their training set perfectly then always pick the smallest value. This is kept as decided, and documented in part 6.ModellingParams()defaults to downsampling, butrunTestsnever applies it. Left unchanged; which should it be?🤖 Generated with Claude Code
https://claude.ai/code/session_01TfsjwkbDbHkX4kJZNe4ER4