-1
$\begingroup$

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.

$\endgroup$
  • $\begingroup$ 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. $\endgroup$ – Robert de Graaf Mar 27 '17 at 5:33
  • $\begingroup$ Oh , thanks for pointing that out! Made the changes, I hope I get some response on this $\endgroup$ – user47 Mar 28 '17 at 3:12
0
$\begingroup$

I had a similar issue. I tried using train from the caret package to solve the issue.

The code will look like:

ctrl <- trainControl(method = "cv", 
                     summaryFunction = twoClassSummary, 
                     classProbs = TRUE)

fit = train(formula,data= creditdataset, method = "gbm",trControl = ctrl,metric = "ROC")

Make sure you see other options in trControl.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.