gbm-developers / gbm

Gradient boosted models (the old gbm package)
Other
51 stars 27 forks source link

CV freeze on MacOS due to parallel::makeCluster() issue in gbmCluster() #53

Open albertbuchard opened 4 years ago

albertbuchard commented 4 years ago

Hi, there is a new issue with parallell:makeCluster() that apparently only affects new version of R on MacOS. (see here)

It causes gbm to freeze when using CV. A quick fix is to pass setup_strategy="sequential" to makeCluster in gbmCluster().

Add in your code before calling gbm:

gbmCluster = function (n) 
{
  if (is.null(n)) {
    n <- parallel::detectCores()
  }
  parallel::makeCluster(n, setup_strategy = "sequential")
}

assignInNamespace("gbmCluster", gbmCluster, ns="gbm")

Hope it is useful to someone ! :)

bgreenwell commented 4 years ago

Thanks @albertbuchard, I'm aware of the problem, but not sure what the best solution is at the moment. Thanks for the suggestion as well!