-
Notifications
You must be signed in to change notification settings - Fork 17
Speed up simulations
People often comment "VAST is so slow, how can I conduct a simulation experiment comparing performance with other models?" It is definitely possible to conduct large, replicated simulation experiments involving VAST (I often do these studies, and others have independently as well), and I use this page to offer a few suggestions for how to speed up simulation experiments.
-
Use more cores -- without any coding changes, you can always install and use Microsoft Open R (MRAN) instead of standard R. MRAN uses all cores available, and many desktops have 4 cores (resulting in 4-times faster models). People at AFSC can ask IT for a Virtual Machine (VM) with 10 cores, resulting in 10-times faster models.
-
Start fixed effects at a good starting point -- VAST by default uses pretty uninformative starting values for fixed and random effects, and then estimation spends a good bit of time improving those. Many configurations of VAST (i.e., index standardization) are guaranteed to have a quadratic likelihood, so are guaranteed to get to the same MLE regardless of starting values. Therefore, a simulation experiment can be sped up by starting at better starting points using
TMBhelper::Optimize( ..., startpar=XXX)
, whereXXX
is the true values, or values from a previous replicate, and this will not affect results except to save time. -
Turn off unnecessary stuff -- VAST is slowed down by using bias-correction, and can be sped up by using
TMBhelper::Optimize( ..., bias.correct=FALSE)
. Similarly, some simulations don't require standard errors, and these can be turned off usingTMBhelper::Optimize( ..., getsd=FALSE)
. Finally, turning off derived quantities by usingOptions = c("Calculate_Range"=FALSE, "Calculate_effective_area"=FALSE)
is faster than when estimating derived quantities. -
Accept results with a higher final gradient -- example scripts for VAST typically are conservative about achieving convergence, and use
TMBhelper::Optimize( ..., newtonsteps=1)
to ensure that final gradients are typically < 1e-8. However, for simulations it might be sufficient to ensure that final gradients are below < 1e-3. This can be achieved by either manually runningnewtonsteps
for chosen replicates, or settingnewtonsteps=0
. -
Reducing spatial resolution -- VAST can always be sped up by decreasing the spatial resolution, i.e., using a lower value for
n_x
.
Options 1-4 will typically not affect inference or scope for a simulation study, while decreasing spatial resolution (#4) will degrade VAST performance and therefore can affect results qualitatively. Finally, users can email a regional VAST POC for more suggestions.