Used in a flash
pipeline to set a maximum amount of fitting
time. Note that timeout conditions are only checked during greedy fits
and backfits, so that the total amount of fitting time can exceed the time
set by flash_set_timeout
(especially if, for example, there is a
nullcheck involving many factor/loading pairs). Also note that timeout
conditions must be cleared using function flash_clear_timeout
before any re-fitting is attempted.
flash_set_timeout(
flash,
tim,
units = c("hours", "secs", "mins", "days", "weeks")
)
A flash
or flash_fit
object.
A numeric value giving the maximum amount of fitting time, with
the units of time specified by parameter units
.
The units of time according to which parameter tim
is to
be interpreted.
The flash
object from argument flash
, with the
timeout settings reflected in updates to the "internal" flash_fit
object. These settings will persist across all subsequent calls to
flash_xxx
functions until they are modified either by
flash_clear_timeout
or by another call to
flash_set_timeout
.
fl <- flash_init(gtex) |>
flash_set_timeout(1, "secs") |>
flash_greedy(Kmax = 30) |>
flash_backfit() |>
flash_nullcheck() |>
flash_clear_timeout() # Always clear timeout at the end of a pipeline.
#> Adding factor 1 to flash object...
#> Adding factor 2 to flash object...
#> Adding factor 3 to flash object...
#> Adding factor 4 to flash object...
#> Adding factor 5 to flash object...
#> Adding factor 6 to flash object...
#> Adding factor 7 to flash object...
#> Adding factor 8 to flash object...
#> Adding factor 9 to flash object...
#> Adding factor 10 to flash object...
#> --Fit timed out after 1.054576 secs !
#> Wrapping up...
#> Done.
#> Fit timed out. Skipping backfit.
#> Nullchecking 10 factors...
#> Done.