Repository navigation
Conversation
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.
This PR is based on #652; the base changes to master after #652 is merged.
Summary
On a projection cache miss,
proj_to_submodl()builds a data frame with the draw-wise responses and callsmodel.frame()andmodel.matrix()for the submodel. A miss takes 1.5-2.1 ms. A LOO validated search with D = 500 candidate terms andnloo = 50makes about 500,000 misses.This PR builds the model matrix of all main-effect terms once per cache store (
design_main_effects()). On a miss,shared_x_from_design()takes the column blocks of the submodel terms. It also builds the rest of the cache entry: thetermsobject withpredvarsanddataClasses, factor levels, contrasts and response names. Without interactions, the columns of a term do not depend on the other terms. The cache entry is then identical to that of the old path (nowproj_prepare_general()).The old path stays for:
data.frame()changes;model.frame()ormodel.matrix()of all candidate terms;projpred.proj_cache_mb.design_main_effects()builds the matrix at the third miss of a cache store.Effect
Simulated Bernoulli data (N 100, D candidate terms, brms reference model), forward search with
nterms_max = 20. Times in seconds; both versions ran in the same job.varsel()cv_varsel(), LOO,nloo = 50varsel()cv_varsel(), LOO,nloo = 50With
loo_perturb_alpha = Inf, the LOO speedup is 1.18 (D 100) and 1.52 (D 500). For 5 GLM data sets with 4-30 predictors, the speedup is 0.98-1.28. In all 21 settings, the two versions give identical rankings, suggested sizes and performance summaries.Tests
tests/testthat/test_proj_design.Rchecks that:identical()to those of the old path for each column type and term type in the test file;varsel()andcv_varsel()give identical results with and without the new path.Without the change, these tests stop with 5 errors. The full test suite with
NOT_CRAN=true(R 4.6.1) gives 0 failures and the same 14 warnings as other branches on master.This PR was assisted by Claude.