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
|
load (sprintf ("%s/data/rsms_protocol_4.Rdata", Sys.getenv ("ABS_TOP_SRCDIR")))
Sys.setlocale ("LC_ALL", "fr_FR.UTF-8")
#' Print the convergence graphs
#' @return the graphs
#' @export
convergence_graph <- function () {
library ("magrittr")
data <- (protocol_4
%>% dplyr::group_by (dataset, maxiter)
%>% dplyr::summarize (mloss = mean (loss),
sloss = sd (loss))
%>% dplyr::mutate (dataset,
`Nombre d'itérations` = maxiter,
`Coût` = mloss,
mini = mloss - sloss,
maxi = mloss + sloss))
arrange <- function (...) {
gridExtra::grid.arrange (..., layout_matrix = rbind (
c (1, 1, 2, 2, 3, 3),
c (4, 4, 5, 5, 6, 6),
c (7, 7, 8, 8, 9, 9),
c (10, 10, 10, 11, 11, 11)
))
}
do.call (arrange, lapply (c ("atp1d", "atp7d", "edm", "enb", "oes10", "oes97", "osales", "scpf", "sf1", "sf2", "wq"), function (dataset_name) {
(data
%>% dplyr::filter (dataset == dataset_name)
%>% ggplot2::ggplot (ggplot2::aes (x = `Nombre d'itérations`,
y = `Coût`,
ymin = mini,
ymax = maxi))
+ ggplot2::geom_line ()
+ ggplot2::geom_ribbon (alpha = 0.2)
+ ggplot2::ggtitle (dataset_name))
}))
}
plot <- convergence_graph ()
filename <- Sys.getenv ("OUTPUT")
ggplot2::ggsave (filename, plot, device = "svg", width = 6, height = 8)
|