mwheymans / psfmi

psfmi: Predictor Selection Functions for Logistic and Cox regression models in multiply imputed datasets
9 stars 6 forks source link

psfmi_validate parallelisation #6

Closed JonNDCN closed 2 years ago

JonNDCN commented 2 years ago

Hello,

Is it possible to parallelise the psfmi_validate function?

This would provide very useful speed improvements in large datasets.

Thank you

JonNDCN commented 2 years ago

I replaced mapply with future_map2 (furrr package) to create opt_boot, which seems to work nicely. Could add a "ncpus" argument to the function.

  plan(multisession, workers = ncpus)
  opt_boot <-
    furrr::future_map2(function(x, y) { --- }, .x = boot_data$splits, .y=boot_seq, .progress = T)

  plan(sequential)