We want to show that the shuffling method has no clear stopping criterion. To this end, let’s generate one cost matrix as we previously did with real values. We will measure the correlations and CV at each iteration.
n <- 100
m <- 30
task <- rgamma_cost(n, 1, 0.3)
proc <- rgamma_cost(m, 1, 0.3)
data <- generate_matrix_shuffling(task, proc, iterations = 1e4)
g_shuffling <- data$measures %>%
gather(measure, value, -iteration) %>%
mutate(measure = factor(measure, levels = c("mean_cor_row",
"mean_cor_col", "CV_meas"),
labels = c("row corr", "col corr", "CV"))) %>%
na.omit() %>%
ggplot(aes(x = iteration, y = value, col = measure)) +
geom_line() +
geom_vline(xintercept = n * m) +
scale_x_continuous(name = "Iteration") +
scale_y_continuous(name = NULL) +
scale_color_brewer(name = "Measure", palette = "Set1") +
coord_cartesian(ylim = c(0, 1))
print(g_shuffling)
library(tikzDevice)
tikz(paste(prefix_path, "shuffling.tex", sep = "/"), width = 3.5, height = 2)
print(g_shuffling)
dev.off()
## png
## 2
We clearly see that the variance continues to increase even after the moment the shuffling method would have stopped.
## R version 3.4.3 (2017-11-30)
## Platform: x86_64-pc-linux-gnu (64-bit)
## Running under: Ubuntu 16.04.4 LTS
##
## Matrix products: default
## BLAS: /usr/lib/openblas-base/libblas.so.3
## LAPACK: /usr/lib/libopenblasp-r0.2.18.so
##
## locale:
## [1] LC_CTYPE=fr_FR.UTF-8 LC_NUMERIC=C
## [3] LC_TIME=fr_FR.UTF-8 LC_COLLATE=fr_FR.UTF-8
## [5] LC_MONETARY=fr_FR.UTF-8 LC_MESSAGES=fr_FR.UTF-8
## [7] LC_PAPER=fr_FR.UTF-8 LC_NAME=C
## [9] LC_ADDRESS=C LC_TELEPHONE=C
## [11] LC_MEASUREMENT=fr_FR.UTF-8 LC_IDENTIFICATION=C
##
## attached base packages:
## [1] stats graphics grDevices utils datasets methods base
##
## other attached packages:
## [1] tikzDevice_0.10-1 bindrcpp_0.2 ggplot2_2.2.1 dplyr_0.7.4
## [5] tidyr_0.2.0 purrr_0.2.4 stringr_1.2.0
##
## loaded via a namespace (and not attached):
## [1] Rcpp_0.12.10 knitr_1.15.1 bindr_0.1
## [4] magrittr_1.5 munsell_0.4 colorspace_1.2-2
## [7] R6_2.1.0 rlang_0.1.6 filehash_2.4-1
## [10] plyr_1.8.1 tools_3.4.3 grid_3.4.3
## [13] gtable_0.1.2 pacman_0.4.6 htmltools_0.3.6
## [16] lazyeval_0.2.0 yaml_2.1.13 rprojroot_1.2
## [19] digest_0.6.3 assertthat_0.1 tibble_1.3.1
## [22] RColorBrewer_1.0-5 reshape2_1.2.2 glue_1.2.0
## [25] evaluate_0.10 rmarkdown_1.8 labeling_0.1
## [28] stringi_0.5-5 compiler_3.4.3 scales_0.4.1
## [31] backports_1.0.5 pkgconfig_2.0.1