-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathM1experiment.R
79 lines (56 loc) · 2.19 KB
/
M1experiment.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
#M1 experiment
rm(list=ls(all=TRUE)) # clear the workspace of anything else
set.seed(1234)
# a script to examine the process from the beginning
library(forecastHelpR)
library(tidyverse)
library(readxl)
library(abind)
library(forecast)
library(Mcomp)
data(M1)
data <- M1
parameters <- setParameters()
retrieval <- retrieveDates(source, parameters)
tsArray <- buildTSArray(data, parameters$nObjects, retrieval$minDate,
retrieval$maxDate, parameters$freqList,
parameters$skipList)
initialObjects <- initialiseModels(parameters$freqList,
tsArray,
parameters$nObjects,
parameters$features,
parameters$numFitSources,
parameters$numGen,
parameters$modelList,
parameters$h,
parameters$maxCluster)
metaY <- initialObjects$MY
fit <- initialObjects$Fi
bestFit <- initialObjects$BF
outcomes <- evolutionaryStage(data,
parameters$numGen,
parameters$nObjects,
metaY,
tsArray,
parameters$permuteParam,
parameters$modelList,
bestFit,
fit,
parameters$h)
wL <- weakLinks(parameters$weakLinkPercent, outcomes$MY, outcomes$BF)
paramList <- list("weakLinks" = wL,
"source" = data,
"MY" = outcomes$MY,
"BF" = outcomes$BF,
"Fi" = outcomes$Fi
)
visualiseWeakLinks(paramList)
newModel <- list("arima", "arima", "arima", "arima",
"arima","arima","arima","holtDamped",
"hwDSeasonalAdditive", "arima", "arima")
usedBC <- c(0, 1, 1, 0,
0, 1, 1,0,
1, 0, 0 )
endOutcomes <- fixWeakLinks(paramList, newModel, parameters, usedBC, data)
## Creating a visual
visualiseEndOutcomes(parameters, endOutcomes)