-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathph3_report_generator.R
175 lines (150 loc) · 5.72 KB
/
ph3_report_generator.R
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
source('funcs.R')
# benchmark models ----
report.full(model = 'snaive()',
series = 'ph3',
transformation = 'identity()',
traindays = 7,
testdays = 1)
report.full(model = 'meanf()',
series = 'ph3',
transformation = 'identity()',
traindays = 7,
testdays = 1)
report.full(model = 'naive()',
series = 'ph3',
transformation = 'identity()',
traindays = 7,
testdays = 1)
# 7:1 full ----
#Error in { : task 2 failed - "cannot allocate vector of size 6.5 Gb"
report.full(model = 'Arima(order=c(1, 0, 0), seasonal=c(1, 0, 0), xreg=fourier(., K=4), method="CSS")',
series = 'ph3',
transformation = 'identity()',
traindays = 7,
testdays = 1,
xreg = 'fourier(., K=4, h=h)')
#$accuracy
# ME RMSE MAE MPE MAPE ACF1 Theil's U
#Test set 5.270776 346.4092 210.4319 -Inf Inf 0.7271158 0
# 1hr30mins of running - sequentially
fullforecast.serial(model = 'Arima(order=c(1, 0, 0), seasonal=c(1, 0, 0), method="CSS")',
dataset = datasets[['ph3']]$series,
transformation = 'identity()',
traindays = 7,
testdays = 1,
xreg = NULL)
# still very high memory usage
fullforecast.serial.obs(model = 'Arima(order=c(1, 0, 0), seasonal=c(1, 0, 0), method="ML")',
dataset = datasets[['ph3']]$series,
transformation = 'identity()',
trainobs = 12, #frequency(datasets[['ph3']]$series),
testobs = 1,
xreg = NULL,
max.iterations = 1)
#simple
report.full(model = 'Arima(order=c(1, 0, 0), seasonal=c(1, 0, 0), method="CSS")',
series = 'ph3',
transformation = 'identity()',
traindays = 7,
testdays = 1,
serial = TRUE)
# inspiration from 1hrs series
report.full(model = 'Arima(order=c(1, 0, 0), seasonal=c(1, 0, 0), method="CSS", xreg=fourier(., K=2))',
series = 'ph3',
transformation = 'identity()',
traindays = 7,
testdays = 1,
xreg = 'fourier(., h=h, K=2)',
serial = TRUE)
# inspiration from 1hrs series without SAR term
report.full(model = 'Arima(order=c(1, 0, 0), method="CSS", xreg=fourier(., K=2))',
series = 'ph3',
transformation = 'identity()',
traindays = 7,
testdays = 1,
xreg = 'fourier(., h=h, K=2)',
serial = TRUE)
# inspiration from 2hrs series
report.full(model = 'Arima(order=c(1, 0, 0), seasonal=c(1, 0, 0), method="CSS", xreg=fourier(., K=1))',
series = 'ph3',
transformation = 'identity()',
traindays = 7,
testdays = 1,
xreg = 'fourier(., h=h, K=1)',
serial = TRUE)
# 7:2 full ----
#simple
report.full(model = 'Arima(order=c(1, 0, 0), seasonal=c(1, 0, 0), method="CSS")',
series = 'ph3',
transformation = 'identity()',
traindays = 7,
testdays = 2,
serial = TRUE)
# inspiration from 1hrs & 2hrs series
report.full(model = 'Arima(order=c(1, 0, 0), seasonal=c(1, 0, 0), method="CSS", xreg=fourier(., K=2))',
series = 'ph3',
transformation = 'identity()',
traindays = 7,
testdays = 2,
xreg = 'fourier(., h=h, K=2)',
serial = TRUE)
# with 8th hour up to 11th dummies (inspiration from 1hrs mainly, but also 2hrs sicne there we had 5 obs)
obsDummies.fcast <- quote(
{cbind(
dummies=getNthObsDummies(8*(frequency(.)/24)+1, 3*(frequency(.)/24), h, frequency(.)),
fourier(., h=h, K=2)
)}
)
obsDummies.fit <- quote(
{cbind(
dummies=getNthObsDummies(8*(frequency(.)/24)+1, 3*(frequency(.)/24), length(.), frequency(.)),
fourier(., K=2)
)}
)
report.full(model = paste0('Arima(order=c(1, 0, 0), seasonal=c(1, 0, 0), method="CSS", xreg=', paste0(deparse(obsDummies.fit), collapse='') ,')'),
series = 'ph3',
transformation = 'identity()',
traindays = 7,
testdays = 2,
xreg = paste0(deparse(obsDummies.fcast), collapse=''),
serial = TRUE)
#direct inspiration from 1hrs ph3 - 9:2 dummies
obsDummies.fcast <- quote(
{cbind(
dummies=getNthObsDummies(9*(frequency(.)/24)+1, 2*(frequency(.)/24), h, frequency(.)),
fourier(., h=h, K=2)
)}
)
obsDummies.fit <- quote(
{cbind(
dummies=getNthObsDummies(9*(frequency(.)/24)+1, 2*(frequency(.)/24), length(.), frequency(.)),
fourier(., K=2)
)}
)
report.full(model = paste0('Arima(order=c(1, 0, 0), seasonal=c(1, 0, 0), method="CSS", xreg=', paste0(deparse(obsDummies.fit), collapse='') ,')'),
series = 'ph3',
transformation = 'identity()',
traindays = 7,
testdays = 2,
xreg = paste0(deparse(obsDummies.fcast), collapse=''),
serial = TRUE)
#direct inspiration from 1hrs ph3 - 9:2 dummies without SAR term
obsDummies.fcast <- quote(
{cbind(
dummies=getNthObsDummies(9*(frequency(.)/24)+1, 2*(frequency(.)/24), h, frequency(.)),
fourier(., h=h, K=2)
)}
)
obsDummies.fit <- quote(
{cbind(
dummies=getNthObsDummies(9*(frequency(.)/24)+1, 2*(frequency(.)/24), length(.), frequency(.)),
fourier(., K=2)
)}
)
report.full(model = paste0('Arima(order=c(1, 0, 0), method="CSS", xreg=', paste0(deparse(obsDummies.fit), collapse='') ,')'),
series = 'ph3',
transformation = 'identity()',
traindays = 7,
testdays = 2,
xreg = paste0(deparse(obsDummies.fcast), collapse=''),
serial = TRUE)