# gbm function not working

I am working on a classification problem, and am applying gradient boosted tress on the dataset, to classify the items into two classes (Fraud -> 1 and No Fraud -> 0)

I am using the below code for my glm methos :

formula = paste(class.label,paste(vars,collapse = ' + '), sep = ' ~ ')

modelGBM = gbm(as.formula(formula), data =  creditdataset,
distribution = 'bernoulli',
n.trees = 400,
interaction.depth = 3,
shrinkage = 0.05,
bag.fraction = 0.5,
keep.data = FALSE,
cv.folds = 5
)


where creditdataset is my dataset.

After I execute the code , I get the following error message :

Error in serialize(data, node\$con) : error writing to connection

I know this kind of error has been discussed here : [https://stackoverflow.com/questions/28503208/doparallel-error-in-r-error-in-serializedata-nodecon-error-writing-to-con][1]

and here :

https://stackoverflow.com/questions/37943295/parallel-programming-in-r-error-writing-to-connection

but these two posts don't really solve the problem. Can anyone point me in the right direction here.

• I note that you've writtten 'glm' (generalised linear model) in your header rather than the correct 'gbm', which may lead to not getting people with the right skills reading your question. – Robert de Graaf Mar 27 '17 at 5:33
• Oh , thanks for pointing that out! Made the changes, I hope I get some response on this – user47 Mar 28 '17 at 3:12

I had a similar issue. I tried using train from the caret package to solve the issue.
ctrl <- trainControl(method = "cv",

Make sure you see other options in trControl.