forked from bsouhaib/prob-hts
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathplot_parameters.R
More file actions
92 lines (74 loc) · 2.77 KB
/
plot_parameters.R
File metadata and controls
92 lines (74 loc) · 2.77 KB
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
# This script produces the table showing the values for the different parameters of the exponential smoothing methods.
rm(list = ls())
source("config_paths.R")
source("config_general.R")
source("config_splitting.R")
source("utils.R")
library(Hmisc)
load(file.path(work.folder, "myinfo.Rdata"))
node_nbkids <- apply(Sagg, 1, sum)
node_order <- sort(node_nbkids, index = T, decreasing = T)$ix
algo <- "DETS"
MAT <- matrix(NA, nrow = n_agg, ncol = 4)
for(i in seq_along(aggSeries)){
idseries <- aggSeries[i]
param_file <- file.path(basef.folder, algo, paste("parameters_", idseries, "_", algo, ".Rdata", sep = ""))
if(file.exists(param_file)){
load(param_file)
MAT[i, ] <- res_optim$par
}else{
print(paste("file does not exist for ", i, sep = ""))
}
}
MAT <- MAT[node_order, ]
savepdf(file.path(results.folder, paste("DETS", sep = "")))
par(mfrow = c(2, 2))
xlab <- "aggregate series"
plot(MAT[, 1], xlab = xlab, ylab = expression(phi))
plot(MAT[, 2], xlab = xlab, ylab = expression(alpha))
plot(MAT[, 3], xlab = xlab, ylab = expression(delta))
plot(MAT[, 4], xlab = xlab, ylab = expression(omega))
endpdf()
savepdf(file.path(results.folder, paste("DETS", sep = "")))
par(mfrow = c(2, 2))
xlab <- "number of aggregated meters (log scale) "
for(j in seq(4)){
if(j == 1){
my_ylab <- expression(phi)
}else if(j == 2){
my_ylab <- expression(alpha)
}else if(j == 3){
my_ylab <- expression(delta)
}else if(j == 4){
my_ylab <- expression(omega)
}
plot(log(node_nbkids), MAT[, j], xlab = xlab, ylab = my_ylab)
}
endpdf()
id <- c(1, 7, 39, 50)
#id <- c(1, 3, 5, 7, 11, 25, 31, 37, 46, 50)
nb <- apply(Sagg, 1, sum)[node_order[id]]
#MAT_toprint <- data.frame(t(MAT)[, id])
#greeks <- c(phi = "$\\phi$", alpha="$\\alpha$", delta = "$\\delta$", omega = "$\\omega$")
MAT_toprint <- data.frame(t(MAT)[c(2, 3, 4, 1), id])
greeks <- c(alpha="$\\alpha$", delta = "$\\delta$", omega = "$\\omega$", phi = "$\\phi$")
row.names(MAT_toprint) <- greeks
colnames(MAT_toprint) <- nb
MAT_toprint <- format.df(MAT_toprint, dec = 3)
latex(MAT_toprint, file= file.path(results.folder, paste("TABLE_DETS.tex")),
title = "", cgroup = "Number of aggregated meters", label = "tab:param_dets",
caption = "Parameters of the exponential smoothing method at different levels of aggregation.")
MAT_bandwiths <- MAT_decay <- matrix(NA, nrow = n_bottom, ncol = 3)
algo <- "KD-IC-NML"
for(i in seq_along(bottomSeries)){
print(i)
idseries <- bottomSeries[i]
param_file <- file.path(basef.folder, algo, paste("parameters_", idseries, "_", algo, ".Rdata", sep = ""))
if(file.exists(param_file)){
load(param_file)
MAT_bandwiths[i, ] <- selected_bandwiths_ic
MAT_decay[i, ] <- selected_lambdas_ic
}else{
print(paste("file does not exist for ", i, sep = ""))
}
}