Quantcast
Viewing all articles
Browse latest Browse all 4448

Error in running GBM

@mudit1712 wrote:

Hi,

I'm trying to run the GBM.FIT for a data and the error i getting is

"The number of rows in x does not equal the length of y"

I 'm attaching the code below for reference.Can anyone help me out ??

library('ElemStatLearn')
library("klaR")
library("caret")
library("gbm")

data(spam)

x=spam[,1:57]# predictor variable
y=spam[,58]#response variable

y <- ifelse(spam=="spam", 0, 1)

ntrees=1000

model<-gbm.fit(x,y,offset=NULL,distribution = "bernoulli",n.trees=ntrees,shrinkage =0.01,interaction.depth = 3,n.minobsinnode = 10,nTrain = NULL,verbose = T)

Posts: 2

Participants: 2

Read full topic


Viewing all articles
Browse latest Browse all 4448

Trending Articles