Repository navigation
12/ Speed and default changes: random forest ranking and mtry, binomial GLM, likelihood ratio, XGB rounds, merge selection cache, light nested CV - #137
Draft
ellispatrick wants to merge 7 commits into
Conversation
ellispatrick
force-pushed
the
review/12-speed-defaults
branch
from
October 10, 2026 22:47
fb4d47e to
c75797d
Compare
ellispatrick
force-pushed
the
review/9-coxnet-path
branch
from
October 10, 2026 22:47
9bff739 to
c712639
Compare
…tion forest instead of growing a second forest (changes rankings) Decided by Ellis Patrick (ProjectClassifyR DECISIONS.md, 10 Oct 2026, Q1). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01TfsjwkbDbHkX4kJZNe4ER4
… split by default, as ranger and randomForestSRC do (changes results) mTryProportion still sets a proportion when given. Decided by Ellis Patrick (ProjectClassifyR DECISIONS.md, 10 Oct 2026, Q2). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01TfsjwkbDbHkX4kJZNe4ER4
…d of a multinomial one (changes predictions slightly) Decided by Ellis Patrick (ProjectClassifyR DECISIONS.md, 10 Oct 2026, Q31). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01TfsjwkbDbHkX4kJZNe4ER4
…features at once Decided by Ellis Patrick (ProjectClassifyR DECISIONS.md, 10 Oct 2026, Q25). Rankings are the same except that features whose statistics differ only by rounding error can swap. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01TfsjwkbDbHkX4kJZNe4ER4
Decided by Ellis Patrick (ProjectClassifyR DECISIONS.md, 10 Oct 2026, Q32). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01TfsjwkbDbHkX4kJZNe4ER4
…use the selection in every combination containing it (identical results) With shared folds, an assay's selection in a split is the same in every combination of assays. The selection is reused only for identical data, outcome and settings; one that draws random numbers is reused only from the same random number state, which is then advanced as selecting again would. Decided by Ellis Patrick (ProjectClassifyR DECISIONS.md, 10 Oct 2026, Q5). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01TfsjwkbDbHkX4kJZNe4ER4
…rially, without fitting an unused model of all training samples (changes results of nested tuning) The inner cross-validation used to repeat the outer scheme (by default 20 x 5 per tuning value) with the outer parallel back-end, and fitted a final model it never used. CrossValParams gains innerPermutations and innerFolds. Decided by Ellis Patrick (ProjectClassifyR DECISIONS.md, 10 Oct 2026, Q15). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01TfsjwkbDbHkX4kJZNe4ER4
ellispatrick
force-pushed
the
review/12-speed-defaults
branch
from
October 14, 2026 00:20
c75797d to
603fa43
Compare
ellispatrick
force-pushed
the
review/9-coxnet-path
branch
from
October 14, 2026 00:20
c712639 to
333aa6c
Compare
This branch has not been deployed
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
Seven speed changes decided by Ellis Patrick (ProjectClassifyR
DECISIONS.md, 10 Oct 2026, Q1, Q2, Q5, Q15, Q25, Q31, Q32).mTryProportionstill sets a proportionbinomialfor two classesWhy
audit-2026-10) has the background: M5 (merge repeats selection), M6 (nested CV), 1B (likelihood ratio) and 1C (random forest).What changes
Q1:
randomForestTrainInterfacegrows one forest withimportance = "impurity", unless the user passesimportance.forestFeaturesranks by that forest's importance, and still reads the oldforImportanceattribute of models saved by earlier versions.runTestsno longer strips that attribute.Q2:
mTryProportion = NULLby default inrandomForestTrainInterfaceandrfsrcTrainInterface. NULL leavesmtryto the package's default: √p, floored by ranger and rounded up by randomForestSRC. The presets vignette says so.Q31:
penalisedGLMtrainInterfaceusesfamily = "binomial"for two classes. Prediction builds both class columns from the probability of the second class. Feature ranking reads the coefficient matrix. Scores for one test sample stay a 1-row matrix.Q25:
likelihoodRatioRankingcomputes each feature's normal log-likelihood in closed form, withcolSumsover a matrix, instead ofmapply/dnormper feature. It also works for one feature and for a class absent from the training set.Q32:
extremeGradientBoostingTrainInterface(nrounds = 100). The presets vignette says so. The"auto"tuning preset (nrounds = c(5, 10)) is unchanged.Q5:
.doSelectionreuses an earlier selection while.runTestsSplitsruns, through a per-process cache:Forked workers each have their own cache; socket workers (Windows) don't use one.
Q15:
CrossValParamsgainsinnerPermutations = 1andinnerFolds = 5. Nested CV, for selection or training parameters, runs that scheme on each training set withSerialParam. It skips the final model of all inner training samples (.prepareTests(finalModel = FALSE)). The ensemble-selection branch of.selectFeatures(Q26, broken) is untouched.Evidence
Scripts: ProjectClassifyR
scripts/speed_defaults/(bench.R,lr_ranking.R, results inresults/). Each build is installed from its commit, run with 4 cores,set.seed(1). Asthma is the package data set (190 × 2000), 20 × 5 CV unless stated; Procedure 1 is the paper's (GHIST, random forest, 100 × 5).Q1 (base 9bff739 → 4b4244a)
Q2 (4b4244a → 77b82fb)
With feature selection (Procedure 1 keeps 20 features) the change is small and mixed. With all 2000 asthma features, √p is 5.3× faster but loses 0.033 balanced accuracy and 0.013 AUC.
Q31 (77b82fb → f7073c2): asthma.
Q25 (f7073c2 → 2d58035)
Q32 (2d58035 → c1b0cce): asthma balanced accuracy 0.7759 → 0.7811, AUC 0.8740 → 0.8760, 6.3 → 7.0 s.
Q5 (c1b0cce → b7ff7cb)
Q15 (b7ff7cb → fb4d47e): asthma, DLDA,
nFeatures = c(5, 10, 25), nested tuning.Tests: 575 expectations pass, with 0 failures. New tests cover:
dnorm;Regression harness (18 scenarios, 1 core, base → this branch without Q15):
🤖 Generated with Claude Code
https://claude.ai/code/session_01TfsjwkbDbHkX4kJZNe4ER4