r - Training Multiple Auto.Arima Models in Parallel -
in code below i'm trying train 2 different auto.arima models @ same time in parallel on different cores. i'm getting error below when try run code. i'm not sure if issue do.call or parlapply, i'm pretty new parallel processing tips helpful.
code: library("forecast") library("parallel") tlist2<-list(x=tsd1, lambda = tlambda, stepwise=true, approximation = true) dlist2<-list(x=tsd2, lambda = rlambda, stepwise=true, approximation = true) ##parallelizing arima model training # calculate number of cores no_cores <- 1 # initiate cluster cl <- makecluster(no_cores) arima_list<-list(tlist2,dlist2) arima_models<-parlapply(cl, arima_list, function(x){do.call(auto.arima, args=x)}) stopcluster(cl) error: error in checkforremoteerrors(val) : 1 node produced error: object 'auto.arima' not found data: dput(tlist2) structure(list(x = c(6, 15.5, 22, 16, na, na, 13, 13.5, 10, 6, 14.5, 16, na, 8, 11, na, 2, 2, 10, na, 9, na, 11, 16, na, 4, 17, 7, 11.5, 22, 20.5, 10, 22, na, 13, 17, 22, 9, 13, 19, 8, 16, 18, 22, 21, 14, 7, 20, 21.5, 17), lambda = 0.999958829041611, stepwise = true, approximation = true), .names = c("x", "lambda", "stepwise", "approximation")) dput(dlist2) structure(list(x = c(11, 4, 8, 11, 11, na, 3, 2.5, 6, 11, 7, 1, na, 6, 6, na, 6, 11, 3, na, 11, na, 10, 10, na, na, 9, 3, 3, 11, 8, 10, na, na, 11, 10, 9, 3, 7, na, 2, 4, 11, 2.5, 3, na, 4, 7, 1, 5), lambda = 0.170065851742339, stepwise = true, approximation = true), .names = c("x", "lambda", "stepwise", "approximation"))
i think forecast::auto.arima should available on clusters, too, try example using clusterevalq this:
tlist2 <- structure(list(x = c(6, 15.5, 22, 16, na, na, 13, 13.5, 10, 6, 14.5, 16, na, 8, 11, na, 2, 2, 10, na, 9, na, 11, 16, na, 4, 17, 7, 11.5, 22, 20.5, 10, 22, na, 13, 17, 22, 9, 13, 19, 8, 16, 18, 22, 21, 14, 7, 20, 21.5, 17), lambda = 0.999958829041611, stepwise = true, approximation = true), .names = c("x", "lambda", "stepwise", "approximation")) dlist2<- structure(list(x = c(11, 4, 8, 11, 11, na, 3, 2.5, 6, 11, 7, 1, na, 6, 6, na, 6, 11, 3, na, 11, na, 10, 10, na, na, 9, 3, 3, 11, 8, 10, na, na, 11, 10, 9, 3, 7, na, 2, 4, 11, 2.5, 3, na, 4, 7, 1, 5), lambda = 0.170065851742339, stepwise = true, approximation = true), .names = c("x", "lambda", "stepwise", "approximation")) library("forecast") library("parallel") cl <- makecluster(no_cores) clusterevalq(cl, library(forecast)) arima_list<-list(tlist2,dlist2) arima_models<-parlapply(cl, arima_list, function(x){do.call(auto.arima, args=x)}) stopcluster(cl)
Comments
Post a Comment