harrysouthworth / gbm

Gradient boosted models
Other
106 stars 27 forks source link

GBM crashing consistently on Mac OS X (10.9.4) #27

Closed kgoldfeld closed 9 years ago

kgoldfeld commented 10 years ago

Every call to gbm (from package version 2.1, R version 3.1.1) on my Mac causes R to abort. Is this a known issue?

screen shot 2014-09-08 at 10 14 17 pm

harrysouthworth commented 10 years ago

Sorry, I've never seen that before so far as I recall. Do you get the same problem with very simple examples? What if you set n.cores=1?

kgoldfeld commented 10 years ago

Thanks for getting back to me so quickly. It still crashes, even with n.cores=1.

This is my code (taken from the gbm help file):

library(gbm) N <- 1000 X1 <- runif(N) X2 <- 2_runif(N) X3 <- ordered(sample(letters[1:4],N,replace=TRUE),levels=letters[4:1]) X4 <- factor(sample(letters[1:6],N,replace=TRUE)) X5 <- factor(sample(letters[1:3],N,replace=TRUE)) X6 <- 3_runif(N) mu <- c(-1,0,1,2)[as.numeric(X3)]

SNR <- 10 # signal-to-noise ratio Y <- X11.5 + 2 * (X2.5) + mu sigma <- sqrt(var(Y)/SNR) Y <- Y + rnorm(N,0,sigma)

data <- data.frame(Y=Y,X1=X1,X2=X2,X3=X3,X4=X4,X5=X5,X6=X6)

fit initial model

gbm1 <- gbm(Y~X1+X2+X3+X4+X5+X6, # formula data=data, # dataset var.monotone=c(0,0,0,0,0,0), # -1: monotone decrease,

+1: monotone increase,

  #  0: no monotone restrictions
  distribution="gaussian",     # see the help for other choices
  n.trees=1000,                # number of trees
  shrinkage=0.05,
  n.cores=1)

I just ran this in R (previously, I had been running from Rstudio), and this is the error message I received:

* caught segfault * address 0x0, cause 'memory not mapped'

Traceback: 1: .Call("gbm", Y = as.double(y), Offset = as.double(offset), X = as.double(x), X.order = as.integer(x.order), weights = as.double(w), Misc = as.double(Misc), cRows = as.integer(cRows), cCols = as.integer(cCols), var.type = as.integer(var.type), var.monotone = as.integer(var.monotone), distribution = as.character(distribution.call.name), n.trees = as.integer(n.trees), interaction.depth = as.integer(interaction.depth), n.minobsinnode = as.integer(n.minobsinnode), n.classes = as.integer(nClass), shrinkage = as.double(shrinkage), bag.fraction = as.double(bag.fraction), nTrain = as.integer(nTrain), fit.old = as.double(NA), n.cat.splits.old = as.integer(0), n.trees.old = as.integer(0), verbose = as.integer(verbose), PACKAGE = "gbm") 2: gbm.fit(x, y, offset = offset, distribution = distribution, w = w, var.monotone = var.monotone, n.trees = n.trees, interaction.depth = interaction.depth, n.minobsinnode = n.minobsinnode, shrinkage = shrinkage, bag.fraction = bag.fraction, nTrain = nTrain, keep.data = keep.data, verbose = lVerbose, var.names = var.names, response.name = response.name, group = group) 3: gbm(Y ~ X1 + X2 + X3 + X4 + X5 + X6, data = data, var.monotone = c(0, 0, 0, 0, 0, 0), distribution = "gaussian", n.trees = 1000, shrinkage = 0.05, n.cores = 1)

Possible actions: 1: abort (with core dump, if enabled) 2: normal R exit 3: exit R without saving workspace 4: exit R saving workspace

Let me know if you would like a core dump or any other info.

From: Harry Southworth notifications@github.com<mailto:notifications@github.com> Reply-To: harrysouthworth/gbm reply@reply.github.com<mailto:reply@reply.github.com> Date: Tuesday, September 9, 2014 at 2:32 AM To: harrysouthworth/gbm gbm@noreply.github.com<mailto:gbm@noreply.github.com> Cc: Keith Goldfeld keith.goldfeld@nyumc.org<mailto:keith.goldfeld@nyumc.org> Subject: Re: [gbm] GBM crashing consistently on Mac OS X (10.9.4) (#27)

Sorry, I've never seen that before so far as I recall. Do you get the same problem with very simple examples? What if you set n.cores=1?

— Reply to this email directly or view it on GitHubhttps://github.com/harrysouthworth/gbm/issues/27#issuecomment-54929878.

Mahalanobis commented 9 years ago

I have the same problem, but this disappear when i don't use mFeatures parameter...

harrysouthworth commented 9 years ago

This issue was moved to gbm-developers/gbm#8