并行模型训练导致错误

时间:2016-11-09 20:35:36

标签: r parallel-processing time-series forecasting

在下面的尝试2中,我尝试并行训练两个模型,但我得到了如下所示的错误。我不清楚为什么结果应该与我在Attempt1中获得的结果有任何不同,即testArrivalCast应该与TaylorFcast< - forecast(Taylor2,h = 80)相同。

Code:

##Attempt 1 

Taylor2 <- tbats(tsdat1);
TaylorFcast <- forecast(Taylor2, h=80);

Taylor3 <- tbats(tsdat2);
Taylor3Fcast <- forecast(Taylor3, h=80);


##Attempt 2

library(parallel)
library(forecast)

# Calculate the number of cores
no_cores <- 2

# Initiate cluster
cl <- makeCluster(no_cores)

tbatsList<-list(tsdat1,tsdat2)

tbatsModels<-parLapply(cl, tbatsList,
        tbats)  

stopCluster(cl)

testArrivalCast<-forecast(tbatsModels[1],h=80)


Error in x - fits : non-numeric argument to binary operator
In addition: Warning message:
In mean.default(x, na.rm = TRUE) :
  argument is not numeric or logical: returning NA


Data:

dput(tsdat1)
c(0.767202484266145, 2.96949977928183, 2.0671481782824, 3.66022236827445, 
1.01872427624301, 0, 4.45424966892274, 2.75619757104319, 1.83011118413722, 
1.01872427624301, 1.53440496853229, 1.48474988964091, 0, 1.83011118413722, 
2.03744855248601, 0, 1.48474988964091, 0.689049392760799, 1.83011118413722, 
0, 3.06880993706458, 0, 1.3780987855216, 1.83011118413722, 0, 
0.767202484266145, 4.45424966892274, 0.689049392760799, 3.66022236827445, 
1.01872427624301, 3.06880993706458, 1.48474988964091, 1.3780987855216, 
0, 4.07489710497203, 1.53440496853229, 4.45424966892274, 2.0671481782824, 
16.471000657235, 1.01872427624301, 3.06880993706458, 10.3932492274864, 
6.89049392760799, 3.66022236827445, 3.05617282872902, 0.767202484266145, 
4.45424966892274, 4.82334574932559, 7.32044473654889, 5.09362138121504, 
0.767202484266145, 10.3932492274864, 3.44524696380399, 9.15055592068612, 
7.13106993370105, 3.06880993706458, 10.3932492274864, 1.3780987855216, 
3.66022236827445, 7.13106993370105, 1.53440496853229, 5.93899955856366, 
4.13429635656479, 9.15055592068612, 6.11234565745804, 0.767202484266145, 
4.45424966892274, 2.0671481782824, 3.66022236827445, 5.09362138121504, 
3.83601242133072, 4.45424966892274, 2.0671481782824, 7.32044473654889, 
7.13106993370105, 4.60321490559687, 7.42374944820457, 6.20144453484719, 
7.32044473654889, 4.07489710497203, 1.53440496853229, 5.93899955856366, 
2.75619757104319, 5.49033355241167, 4.07489710497203, 1.53440496853229, 
5.93899955856366, 1.3780987855216, 1.83011118413722, 5.09362138121504, 
1.53440496853229, 2.96949977928183, 2.0671481782824, 7.32044473654889, 
3.05617282872902, 2.30160745279843, 8.90849933784549, 0, 3.66022236827445, 
1.01872427624301)


dput(tsdat2)
c(0, 0.677941131252747, 3.99398258840342, 15.5297069982532, 16.1737777858183, 
12.8178898504978, 6.10147018127472, 14.6446028241459, 38.824267495633, 
32.3475555716366, 24.1277926597606, 12.2029403625494, 22.6325680009527, 
41.4125519953419, 34.3692777948639, 23.373799139143, 9.49117583753845, 
15.9759303536137, 31.0594139965064, 25.2715277903411, 19.6038315360555, 
10.1691169687912, 22.6325680009527, 38.824267495633, 31.336694460023, 
24.1277926597606, 10.1691169687912, 23.9638955304205, 46.5891209947596, 
34.3692777948639, 25.6357797009956, 14.2367637563077, 27.9578781188239, 
55.6481167437407, 44.4778889110003, 36.1916889896408, 15.5926460188132, 
29.2892056482917, 59.530543493304, 62.6733889200459, 42.223637154581, 
19.6602928063297, 45.2651360019054, 106.119664488064, 78.8471667058642, 
60.3194816494014, 25.7617629876044, 51.9217736492444, 111.296233487481, 
95.0209444916825, 75.3993520617518, 34.5749976938901, 71.8916865912615, 
150.120500983114, 119.28161117041, 95.0031835978072, 42.0323501376703, 
89.198944474343, 176.003345980203, 133.433666733001, 107.067079927687, 
44.7441146626813, 90.5302720038108, 188.944768478747, 149.607444518819, 
117.622989216333, 52.2014671064615, 103.843547298489, 199.297906477583, 
151.629166742047, 113.099028092628, 50.845584843956, 102.512219769021, 
186.356483979039, 147.585722295592, 114.607015133863, 52.8794082377142, 
106.506202357424, 225.180751474671, 173.868111197547, 129.686885546213, 
56.269113893978, 109.16885741636, 209.651044476418, 161.737777858183, 
120.638963298803, 50.845584843956, 95.855582121682, 183.76819947933, 
137.477111179456, 99.5271447215123, 43.3882324001758, 78.5483242386005, 
150.120500983114, 117.259888947183, 84.447274309162, 36.6088210876483, 
68.563367767592, 126.825940485735, 95.0209444916825)

0 个答案:

没有答案