0

I am trying to use spline transformation(bs function) in the boosting algorithm in R. (gbm function). However, when I write the following code it throws me an error:

gbm(as.integer(cancel) ~ bs(log_tenure), data = train, distribution = "bernoulli")

Error in data.matrix(x) : number of items to replace is not a multiple of replacement length

Is there any way I can use spline transformations in gbm function in R?

DS_Enthusiast
  • 65
  • 1
  • 8
  • 2
    It would be easier to help you if you provided a [reproducible example](https://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example) with sample input data so we can actually run the code to see what's happening. – MrFlick Nov 02 '17 at 23:18
  • Provide an example, of yor data, please. – Henry Navarro Nov 03 '17 at 08:24
  • the GBM algorithm is invariant to the scale of the variable, only order of the values of the variable is important. So you don't need to apply spline. – Metariat Apr 08 '18 at 18:51

0 Answers0