dmolitor / bolasso

Model consistent Lasso estimation through the bootstrap.
https://dmolitor.github.io/bolasso/
Other
3 stars 0 forks source link

`bolasso()` with `implement = "gamlr"` returns empty object when run in parallel #1

Closed dmolitor closed 2 years ago

dmolitor commented 2 years ago

Will add a reprex below.

dmolitor commented 2 years ago

The promised reprex:

library(bolasso)
#> Loading required package: Matrix
library(future)

plan("multisession")

data(PimaIndiansDiabetes, package = "mlbench")

model <- bolasso(
  diabetes ~ .,
  data = PimaIndiansDiabetes,
  n.boot = 10, 
  implement = "gamlr",
  family = "binomial"
)
#> Loading required package: gamlr
#> Loading required package: gamlr
#> Loading required package: gamlr
#> Loading required package: gamlr
#> Loading required package: gamlr
#> Loading required package: gamlr
#> Loading required package: gamlr
#> Loading required package: gamlr

# Print model
model
#> Error in 1:ncol(c): argument of length 0

plan("sequential")
plan("multisession")

model2 <- bolasso(
  diabetes ~ .,
  data = PimaIndiansDiabetes,
  n.boot = 10, 
  implement = "glmnet",
  family = "binomial"
)

# Print model
model2
#> ------------- 10-fold bootstrapped Lasso -------------
#> 
#> Model matrix dimensions:
#>    - 8 Predictors
#>    - 768 Observations
#> 
#> Selected variables:
#>    - 5/8 predictors selected with 90% threshold
#>    - 5/8 predictors selected with 100% threshold

Created on 2021-12-13 by the reprex package (v2.0.1)