I want to run the cv.glmnet function with the same data (y and x) with different values on the alpha parameter determined by the number of cores, but the result is absurd. What is wrong in the code below?
 
Patrik Waldmann
 
x <- matrix(rnorm(2000*10000),ncol=10000)
y <- matrix(rnorm(2000),ncol=1)
 
library(parallel)
cvglmnet <- function(...) {
library(glmnet)
cv.glmnet(x,y,alpha=alphasplit)
}
system.time(cores<-detectCores())
system.time(cl <- makeCluster(cores, methods=FALSE))
alpha<-seq(0, 1,by=1/(cores-1))
alphasplit<-clusterSplit(cl,alpha)
system.time(clusterExport(cl, c("x","y","cvglmnet","alphasplit")))
system.time(outbrlist<-clusterEvalQ(cl, cvglmnet(x,y,alphasplit)))
system.time(totoutbr<-do.call(cbind,outbrlist))
stopCluster(cl)

	[[alternative HTML version deleted]]

