tidyverts / fabletools

General fable features useful for extension packages
http://fabletools.tidyverts.org/
89 stars 31 forks source link

Random Number Generation in the Future Framework #384

Closed mabuimo closed 4 months ago

mabuimo commented 11 months ago

Hi, I am getting the following warnings when I fit prophet models (prophet.fable) with future::plan(multisession) stated before the model estimation.

 UNRELIABLE VALUE: One of the ‘future.apply’ iterations (‘future_mapply-16’) unexpectedly generated random numbers without declaring so. There is a risk that those random numbers are not statistically sound and the overall results might be invalid. To fix this, specify 'future.seed=TRUE'. This ensures that proper, parallel-safe random numbers are produced via the L'Ecuyer-CMRG method. To disable this check, use 'future.seed = NULL', or set option 'future.rng.onMisuse' to "ignore". 

This resource explains the problem and how to solve it. One option is declaring future.seed=TRUE, presumably here?:

make_future_data <- function(.data, h = NULL){
  n <- get_frequencies(h, .data, .auto = "smallest")
mapply_maybe_parallel <- function (.f, ..., MoreArgs = list(), SIMPLIFY = FALSE) {
  if(is_attached("package:future")){
    require_package("future.apply")

Thanks.

mitchelloharawild commented 4 months ago

Fixed, thanks!