c-rutter / imabc

Home Page:https://c-rutter.github.io/imabc/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Can doRNG be used to streamline IMABC?

jozik opened this issue · comments

The doRNG package ensures reproducibility in a similar way that imabc currently manually manages. Could the doRNG package be used directly to streamline and generalize the run_handler etc.?

https://cran.r-project.org/web/packages/doRNG/vignettes/doRNG.pdf

I think there are pros and cons to this. One pro is that we would be able to remove all of our seed control code. A user could just run set.seed() before calling imabc and then we would just need to save the seed values from the run_handler results. However, if we did this, when a user used the custom backend input, we would need to either require/explain that the user must have their custom backend return a seed value in a similar manner to what doRNG returns OR no longer save the seed values to iter_parm_draws. For the custom backend, using this would put seed control completely in the hands of the user where the current code ensures that any user will get the same (and proper) seed control.

Right now, the code does:

  1. Set seed
  2. Simulate LHS
  3. Generate seed stream
  4. Pass seed stream and LHS to target function or custom backend (in a parallel environment)
  5. get estimated target values

With this, the code would do:

  1. Simulate LHS
  2. Pass LHS to target function,
    a. With no custom backend, if user set a seed before running imabc, use different seeds from stream for target function
    b. With a custom backend, hope the user has properly specified a seed control mechanism appropriate for their backend if they desire.
  3. get estimated target values
    a. With no custom backend, we could pull the associated seed value used for that iteration
    b. With a custom backend, we could only pull the seed values if the user returned the seeds properly
    b. Alternatively, we could just stop saving the seed values