0

I am trying to run the GBM code in R :

gbmModel = gbm(formula = formula_gbm,
               distribution = "bernoulli",
               data = dev_new,
               n.trees = 200,
               interaction.depth = 6,
               train.fraction=0.6,
               bag.fraction = 0.6, 
               shrinkage = 0.4, 
               cv.folds=1,
               verbose = TRUE)  

When I try with cv.folds=0, it runs perfectly- as soon as I am using cv.folds>0, I am facing the below error. Any idea why this might be happening? Thanks in advance!

Iter   TrainDeviance   ValidDeviance   StepSize   Improve
     1        0.1165          0.1206     0.4000   -0.0037
     2        0.1977          0.2197     0.4000   -0.0484
     3        0.2706          0.2493     0.4000   -0.0606
     4        0.2705          0.2556     0.4000   -0.0047
     5        0.2691          0.2559     0.4000    0.0004
     6        0.2954             inf     0.4000   -0.0395
     7        0.2786             inf     0.4000    0.0076
     8        0.2790             inf     0.4000   -0.0010
     9        0.2694             inf     0.4000    0.0027
    10        0.2694             inf     0.4000   -0.0006

*Error in gbm(formula = formula_gbm, distribution = "bernoulli", data = dev_new,  : 
  object 'p' not found*
user2458552
  • 419
  • 2
  • 5
  • 17
  • To cite from the linked post: *"The input data in the R function gbm() cannot include the variables (columns) that will not be used in your model."* – Maurits Evers Aug 17 '18 at 11:42
  • Yes i am subsetting the data to contain only variables being used in the model- still getting this.. What is "object p"? – user2458552 Aug 17 '18 at 13:52
  • *"Yes i am subsetting the data to contain only variables being used in the model- still getting this."* We're left speculating what you're doing because you don't provide a reproducible code example with sample data. If unsure you should review how to provide a [minimal reproducible example/attempt](https://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example). – Maurits Evers Aug 17 '18 at 14:06
  • You still getting this or did you find a solution? I've got an example I intend to post but I wanted to see if you had sorted it first. – Badger Feb 19 '20 at 15:49

0 Answers0