flash_greedy | R Documentation |
Adds factor/loadings pairs to a flash object in a "greedy" manner. Up to
Kmax
pairs are added one at a time. At each step, flash_greedy
attempts to find an optimal additional (rank-one) factor given all
previously added factors. The additional factor is retained if it
increases the variational lower bound (ELBO); otherwise, fitting terminates.
See flash
for examples of usage.
flash_greedy(
flash,
Kmax = 1,
ebnm_fn = ebnm_point_normal,
init_fn = NULL,
extrapolate = FALSE,
warmstart = FALSE,
maxiter = 500,
tol = NULL,
verbose = NULL
)
flash |
A |
Kmax |
The maximum number of factors to be added. This will not
necessarily be the total number of factors added by
|
ebnm_fn |
The function or functions used to solve the empirical Bayes
normal means (EBNM) subproblems. Most importantly, these functions specify
the families of distributions Any EBNM function provided by package |
init_fn |
The function used to initialize factor/loadings pairs. Functions
|
extrapolate |
Whether to use an extrapolation technique
inspired by Ang and Gillis (2019) to accelerate the fitting process.
Control parameters are handled via global options and can be set by
calling |
warmstart |
Whether to use "warmstarts" when solving the EBNM
subproblems by initializing solutions at the previous value of the fitted
prior |
maxiter |
The maximum number of iterations when optimizing a greedily added factor/loadings pair. |
tol |
The convergence tolerance parameter. At each iteration, the fit
is compared to the fit from the previous iteration using a convergence
criterion function (by default, the difference in ELBO, but the criterion
can be changed via |
verbose |
When and how to display progress updates. Set to
|
The flash
object from argument flash
, with up
to Kmax
new factor/loadings pairs "greedily" added.
flash_greedy_init_default
,
flash_greedy_init_softImpute
,
flash_greedy_init_irlba
# The following are examples of advanced usage. See ?flash for basic usage.
# Increase the maximum number of iterations in the default initialization
# method.
my_init_fn <- function(f) flash_greedy_init_default(f, maxiter = 500)
fl <- flash_init(gtex) %>%
flash_greedy(init_fn = my_init_fn)
# Use a custom initialization function that wraps function nmf from
# package RcppML.
nmf_init_fn <- function(f) {
nmf_res <- RcppML::nmf(resid(f), k = 1, verbose = FALSE)
return(list(as.vector(nmf_res$w), as.vector(nmf_res$h)))
}
fl.nmf <- flash_init(gtex) %>%
flash_greedy(ebnm_fn = ebnm_unimodal_nonnegative,
init_fn = nmf_init_fn)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.