Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,12 @@ If you read this from a place other than <https://mc-stan.org/projpred/news/inde

## Major changes

* Faster projections onto submodels without group-level or additive terms: the projected draws (or clusters) share one model matrix, and for the Gaussian family with the identity link, one linear solve gives the submodel fits for all draws. For example, `varsel()` with forward search for a Gaussian model with 50 observations and 200 predictor terms is about 7 times faster. (GitHub: #574)

* Faster projections onto binomial and Poisson GLM submodels (and Gaussian GLM submodels with a non-identity link): the IRLS fits compute their pseudo-observations in C++, and one C++ call fits all projected draws (or clusters). For example, `cv_varsel()` with `validate_search = TRUE` for binomial and Poisson models is about 4 to 6 times faster. (GitHub: #581)

* `varsel()`, `cv_varsel()` and `project()` cache the submodel formulas and model matrices per set of predictor terms, so the folds of `cv_varsel()` with `validate_search = TRUE` do not build them again. For example, `cv_varsel()` with `validate_search = TRUE` for binomial and Poisson models is about 1.3 to 1.7 times faster. (GitHub: #582)

## Minor changes

## Bug fixes and maintenance
Expand Down
8 changes: 8 additions & 0 deletions R/RcppExports.R
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,11 @@ glm_ridge_c <- function(x, pseudo_obs, lambda, intercept, penalty, beta_init, w_
.Call('_projpred_glm_ridge_c', PACKAGE = 'projpred', x, pseudo_obs, lambda, intercept, penalty, beta_init, w_init, thresh, qa_updates_max, ls_iter_max, debug)
}

glm_ridge_native_c <- function(x, y, weights, offset, family_code, link_code, lambda, intercept, penalty, beta_init, w_init, thresh, qa_updates_max, ls_iter_max = 100L, debug = FALSE) {
.Call('_projpred_glm_ridge_native_c', PACKAGE = 'projpred', x, y, weights, offset, family_code, link_code, lambda, intercept, penalty, beta_init, w_init, thresh, qa_updates_max, ls_iter_max, debug)
}

glm_ridge_native_multi_c <- function(x, y, weights, offset, family_code, link_code, lambda, intercept, penalty, beta_init, w_init, thresh, qa_updates_max, ls_iter_max = 100L, debug = FALSE) {
.Call('_projpred_glm_ridge_native_multi_c', PACKAGE = 'projpred', x, y, weights, offset, family_code, link_code, lambda, intercept, penalty, beta_init, w_init, thresh, qa_updates_max, ls_iter_max, debug)
}

4 changes: 4 additions & 0 deletions R/cv_varsel.R
Original file line number Diff line number Diff line change
Expand Up @@ -336,6 +336,10 @@ cv_varsel.refmodel <- function(
}
set.seed(seed)
}
# Activate the cache of the projection inputs (see proj_cache_store()). This
# follows the `on.exit()` call above, which has no `add = TRUE`:
proj_cache_enter()
on.exit(proj_cache_exit(), add = TRUE)

refmodel <- object
nterms_all <- count_terms_in_formula(refmodel$formula) - 1L
Expand Down
Loading
Loading