Backfits existing flash factor/loadings pairs. Whereas a "greedy" fit optimizes
each newly added factor/loadings pair in one go without returning to optimize
previously added pairs, a "backfit" updates all existing pairs in a cyclical
fashion. See flash
for examples of usage.
flash_backfit(
flash,
kset = NULL,
extrapolate = TRUE,
warmstart = TRUE,
maxiter = 500,
tol = NULL,
verbose = NULL
)
A flash
or flash_fit
object.
A vector of integers specifying which factors to backfit.
If kset = NULL
, then all existing factors will be backfitted.
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 options("extrapolate.control") <- control.param
.
Whether to use "warmstarts" when solving the EBNM
subproblems by initializing solutions at the previous value of the fitted
prior \(\hat{g}\). An important side effect of warmstarts for
ashr
-like prior families is to fix the grid at its initial setting.
Fixing the grid can lead to poor fits if there
are large changes in the scale of the estimated prior over the
course of the fitting process. However, allowing the grid to
vary can occasionally result in decreases in ELBO.
The maximum number of backfitting iterations. An "iteration"
is defined such that all factors in kset
get updated at each
iteration.
The convergence tolerance parameter. After each update, the fit
is compared to the fit from before the update using a convergence
criterion function (by default, the difference in ELBO, but the criterion
can be changed via flash_set_conv_crit
).
The backfit is considered to have "converged" when the value of the
convergence criterion function over successive updates to
all factor/loadings pairs is less than or equal to tol
. If,
for example, factor/loadings pairs \(1, \ldots, K\) are being
sequentially backfitted, then fits are compared before and
after the update to factor/loadings 1, before and after the update to
factor/loadings 2, and so on through factor/loadings \(K\),
and backfitting only terminates when the convergence criterion function
returns a value less
than or equal to tol
for all \(K\) updates. Note that
specifying tol
here will override any value set by
flash_set_conv_crit
; to use the "global" tolerance parameter,
tol
must be left unspecified (NULL
).
If tol = NULL
and a global tolerance
parameter has not been set, then the default
tolerance used is \(np\sqrt{\epsilon}\), where \(n\) is the
number of rows in the dataset, \(p\) is the number of columns, and
\(\epsilon\) is equal to .Machine$double.eps
.
When and how to display progress updates. Set to
0
for none, 1
for updates after a factor is added or a
backfit is completed, 2
for additional notifications about the
variational lower bound, and 3
for updates after every iteration.
It is also possible to output a single tab-delimited table of values
using function flash_set_verbose
with verbose = -1
.
The flash
object from argument flash
, backfitted
as specified.