Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Error in summary.connection(connection) : invalid connection

Having an issue while running a logistic regression model using caret::train(). LR = caret::train(Satisfaction ~., data= log_train, method = "glm", preProcess = c("scale"), family="binomial")

keep getting the following line of error:

Error in summary.connection(connection) : invalid connection

This error seems new to me as when i had previously run this code, i did not see any issue. Please help!

like image 807
Manasi bhargav Avatar asked Oct 25 '20 01:10

Manasi bhargav


1 Answers

I got this error because of an issue with the parallel computing back-end for foreach/dopar. You may have some parallel computing going on in the background that is not getting cleaned up fully between runs. The easiest way I have found to fix it is to call this function:

unregister_dopar <- function() {
  env <- foreach:::.foreachGlobals
  rm(list=ls(name=env), pos=env)
}

This function is from Steve Weston's accepted answer in this thread: "un-register" a doParallel cluster

like image 156
KRBundy Avatar answered Nov 13 '22 06:11

KRBundy