-
Notifications
You must be signed in to change notification settings - Fork 34
colRowWeightedMeans
matrixStats: Benchmark report
This report benchmark the performance of colWeightedMeans() and rowWeightedMeans() against alternative methods.
- apply() + weighted.mean()
> rmatrix <- function(nrow, ncol, mode = c("logical", "double", "integer", "index"), range = c(-100,
+ +100), na_prob = 0) {
+ mode <- match.arg(mode)
+ n <- nrow * ncol
+ if (mode == "logical") {
+ x <- sample(c(FALSE, TRUE), size = n, replace = TRUE)
+ } else if (mode == "index") {
+ x <- seq_len(n)
+ mode <- "integer"
+ } else {
+ x <- runif(n, min = range[1], max = range[2])
+ }
+ storage.mode(x) <- mode
+ if (na_prob > 0)
+ x[sample(n, size = na_prob * n)] <- NA
+ dim(x) <- c(nrow, ncol)
+ x
+ }
> rmatrices <- function(scale = 10, seed = 1, ...) {
+ set.seed(seed)
+ data <- list()
+ data[[1]] <- rmatrix(nrow = scale * 1, ncol = scale * 1, ...)
+ data[[2]] <- rmatrix(nrow = scale * 10, ncol = scale * 10, ...)
+ data[[3]] <- rmatrix(nrow = scale * 100, ncol = scale * 1, ...)
+ data[[4]] <- t(data[[3]])
+ data[[5]] <- rmatrix(nrow = scale * 10, ncol = scale * 100, ...)
+ data[[6]] <- t(data[[5]])
+ names(data) <- sapply(data, FUN = function(x) paste(dim(x), collapse = "x"))
+ data
+ }
> data <- rmatrices(mode = "double")
> X <- data[["10x10"]]
> w <- runif(nrow(X))
> gc()
used (Mb) gc trigger (Mb) max used (Mb)
Ncells 3060186 163.5 5723390 305.7 5723390 305.7
Vcells 5582772 42.6 12256490 93.6 12255936 93.6
> colStats <- microbenchmark(colWeightedMeans = colWeightedMeans(X, w = w, na.rm = FALSE), `apply+weigthed.mean` = apply(X,
+ MARGIN = 2L, FUN = weighted.mean, w = w, na.rm = FALSE), unit = "ms")
> X <- t(X)
> gc()
used (Mb) gc trigger (Mb) max used (Mb)
Ncells 3059432 163.4 5723390 305.7 5723390 305.7
Vcells 5580819 42.6 12256490 93.6 12255936 93.6
> rowStats <- microbenchmark(rowWeightedMeans = rowWeightedMeans(X, w = w, na.rm = FALSE), `apply+weigthed.mean` = apply(X,
+ MARGIN = 1L, FUN = weighted.mean, w = w, na.rm = FALSE), unit = "ms")
Table: Benchmarking of colWeightedMeans() and apply+weigthed.mean() on 10x10 data. The top panel shows times in milliseconds and the bottom panel shows relative times.
expr | min | lq | mean | median | uq | max | |
---|---|---|---|---|---|---|---|
1 | colWeightedMeans | 0.009636 | 0.010553 | 0.0188809 | 0.0124755 | 0.0240735 | 0.070946 |
2 | apply+weigthed.mean | 0.060421 | 0.061921 | 0.0890214 | 0.0636535 | 0.1211720 | 0.319313 |
expr | min | lq | mean | median | uq | max | |
---|---|---|---|---|---|---|---|
1 | colWeightedMeans | 1.00000 | 1.000000 | 1.000000 | 1.00000 | 1.000000 | 1.000000 |
2 | apply+weigthed.mean | 6.27034 | 5.867621 | 4.714888 | 5.10228 | 5.033418 | 4.500789 |
Table: Benchmarking of rowWeightedMeans() and apply+weigthed.mean() on 10x10 data (transposed). The top panel shows times in milliseconds and the bottom panel shows relative times. |
expr | min | lq | mean | median | uq | max | |
---|---|---|---|---|---|---|---|
1 | rowWeightedMeans | 0.011269 | 0.012091 | 0.0134532 | 0.0134335 | 0.0138740 | 0.046038 |
2 | apply+weigthed.mean | 0.055986 | 0.057190 | 0.0595293 | 0.0581220 | 0.0589225 | 0.160270 |
expr | min | lq | mean | median | uq | max | |
---|---|---|---|---|---|---|---|
1 | rowWeightedMeans | 1.000000 | 1.000000 | 1.000000 | 1.000000 | 1.000000 | 1.000000 |
2 | apply+weigthed.mean | 4.968143 | 4.729964 | 4.424913 | 4.326646 | 4.246973 | 3.481255 |
Figure: Benchmarking of colWeightedMeans() and apply+weigthed.mean() on 10x10 data as well as rowWeightedMeans() and apply+weigthed.mean() on the same data transposed. Outliers are displayed as crosses. Times are in milliseconds. |
Table: Benchmarking of colWeightedMeans() and rowWeightedMeans() on 10x10 data (original and transposed). The top panel shows times in milliseconds and the bottom panel shows relative times.
expr | min | lq | mean | median | uq | max | |
---|---|---|---|---|---|---|---|
1 | colWeightedMeans | 9.636 | 10.553 | 18.88091 | 12.4755 | 24.0735 | 70.946 |
2 | rowWeightedMeans | 11.269 | 12.091 | 13.45321 | 13.4335 | 13.8740 | 46.038 |
expr | min | lq | mean | median | uq | max | |
---|---|---|---|---|---|---|---|
1 | colWeightedMeans | 1.000000 | 1.000000 | 1.0000000 | 1.00000 | 1.0000000 | 1.0000000 |
2 | rowWeightedMeans | 1.169469 | 1.145741 | 0.7125297 | 1.07679 | 0.5763184 | 0.6489161 |
Figure: Benchmarking of colWeightedMeans() and rowWeightedMeans() on 10x10 data (original and transposed). Outliers are displayed as crosses. Times are in milliseconds. |
> X <- data[["100x100"]]
> w <- runif(nrow(X))
> gc()
used (Mb) gc trigger (Mb) max used (Mb)
Ncells 3058041 163.4 5723390 305.7 5723390 305.7
Vcells 5195681 39.7 12256490 93.6 12255936 93.6
> colStats <- microbenchmark(colWeightedMeans = colWeightedMeans(X, w = w, na.rm = FALSE), `apply+weigthed.mean` = apply(X,
+ MARGIN = 2L, FUN = weighted.mean, w = w, na.rm = FALSE), unit = "ms")
> X <- t(X)
> gc()
used (Mb) gc trigger (Mb) max used (Mb)
Ncells 3058035 163.4 5723390 305.7 5723390 305.7
Vcells 5205724 39.8 12256490 93.6 12256404 93.6
> rowStats <- microbenchmark(rowWeightedMeans = rowWeightedMeans(X, w = w, na.rm = FALSE), `apply+weigthed.mean` = apply(X,
+ MARGIN = 1L, FUN = weighted.mean, w = w, na.rm = FALSE), unit = "ms")
Table: Benchmarking of colWeightedMeans() and apply+weigthed.mean() on 100x100 data. The top panel shows times in milliseconds and the bottom panel shows relative times.
expr | min | lq | mean | median | uq | max | |
---|---|---|---|---|---|---|---|
1 | colWeightedMeans | 0.028383 | 0.033486 | 0.0478464 | 0.0410575 | 0.0549215 | 0.198953 |
2 | apply+weigthed.mean | 0.633513 | 0.719832 | 0.9739697 | 0.8252475 | 0.9051010 | 12.233552 |
expr | min | lq | mean | median | uq | max | |
---|---|---|---|---|---|---|---|
1 | colWeightedMeans | 1.00000 | 1.00000 | 1.00000 | 1.0000 | 1.0000 | 1.00000 |
2 | apply+weigthed.mean | 22.32016 | 21.49651 | 20.35615 | 20.0998 | 16.4799 | 61.48966 |
Table: Benchmarking of rowWeightedMeans() and apply+weigthed.mean() on 100x100 data (transposed). The top panel shows times in milliseconds and the bottom panel shows relative times. |
expr | min | lq | mean | median | uq | max | |
---|---|---|---|---|---|---|---|
1 | rowWeightedMeans | 0.102932 | 0.1044455 | 0.1089756 | 0.1059725 | 0.107849 | 0.205329 |
2 | apply+weigthed.mean | 0.559603 | 0.5716445 | 0.6829289 | 0.5765340 | 0.591096 | 8.947814 |
expr | min | lq | mean | median | uq | max | |
---|---|---|---|---|---|---|---|
1 | rowWeightedMeans | 1.000000 | 1.000000 | 1.000000 | 1.000000 | 1.000000 | 1.00000 |
2 | apply+weigthed.mean | 5.436628 | 5.473137 | 6.266807 | 5.440411 | 5.480774 | 43.57794 |
Figure: Benchmarking of colWeightedMeans() and apply+weigthed.mean() on 100x100 data as well as rowWeightedMeans() and apply+weigthed.mean() on the same data transposed. Outliers are displayed as crosses. Times are in milliseconds. |
Table: Benchmarking of colWeightedMeans() and rowWeightedMeans() on 100x100 data (original and transposed). The top panel shows times in milliseconds and the bottom panel shows relative times.
expr | min | lq | mean | median | uq | max | |
---|---|---|---|---|---|---|---|
1 | colWeightedMeans | 28.383 | 33.4860 | 47.84645 | 41.0575 | 54.9215 | 198.953 |
2 | rowWeightedMeans | 102.932 | 104.4455 | 108.97558 | 105.9725 | 107.8490 | 205.329 |
expr | min | lq | mean | median | uq | max | |
---|---|---|---|---|---|---|---|
1 | colWeightedMeans | 1.000000 | 1.00000 | 1.000000 | 1.000000 | 1.000000 | 1.000000 |
2 | rowWeightedMeans | 3.626537 | 3.11908 | 2.277611 | 2.581075 | 1.963694 | 1.032048 |
Figure: Benchmarking of colWeightedMeans() and rowWeightedMeans() on 100x100 data (original and transposed). Outliers are displayed as crosses. Times are in milliseconds. |
> X <- data[["1000x10"]]
> w <- runif(nrow(X))
> gc()
used (Mb) gc trigger (Mb) max used (Mb)
Ncells 3058772 163.4 5723390 305.7 5723390 305.7
Vcells 5200094 39.7 12256490 93.6 12256404 93.6
> colStats <- microbenchmark(colWeightedMeans = colWeightedMeans(X, w = w, na.rm = FALSE), `apply+weigthed.mean` = apply(X,
+ MARGIN = 2L, FUN = weighted.mean, w = w, na.rm = FALSE), unit = "ms")
> X <- t(X)
> gc()
used (Mb) gc trigger (Mb) max used (Mb)
Ncells 3058760 163.4 5723390 305.7 5723390 305.7
Vcells 5210127 39.8 12256490 93.6 12256404 93.6
> rowStats <- microbenchmark(rowWeightedMeans = rowWeightedMeans(X, w = w, na.rm = FALSE), `apply+weigthed.mean` = apply(X,
+ MARGIN = 1L, FUN = weighted.mean, w = w, na.rm = FALSE), unit = "ms")
Table: Benchmarking of colWeightedMeans() and apply+weigthed.mean() on 1000x10 data. The top panel shows times in milliseconds and the bottom panel shows relative times.
expr | min | lq | mean | median | uq | max | |
---|---|---|---|---|---|---|---|
1 | colWeightedMeans | 0.039137 | 0.0413845 | 0.044809 | 0.0431425 | 0.0444280 | 0.127886 |
2 | apply+weigthed.mean | 0.203658 | 0.2095140 | 0.265785 | 0.2203085 | 0.2248705 | 4.553261 |
expr | min | lq | mean | median | uq | max | |
---|---|---|---|---|---|---|---|
1 | colWeightedMeans | 1.00000 | 1.00000 | 1.000000 | 1.000000 | 1.000000 | 1.00000 |
2 | apply+weigthed.mean | 5.20372 | 5.06262 | 5.931511 | 5.106531 | 5.061459 | 35.60406 |
Table: Benchmarking of rowWeightedMeans() and apply+weigthed.mean() on 1000x10 data (transposed). The top panel shows times in milliseconds and the bottom panel shows relative times. |
expr | min | lq | mean | median | uq | max | |
---|---|---|---|---|---|---|---|
1 | rowWeightedMeans | 0.127435 | 0.1350745 | 0.1486614 | 0.1405780 | 0.152598 | 0.270186 |
2 | apply+weigthed.mean | 0.186238 | 0.1958935 | 0.2993938 | 0.2019265 | 0.239312 | 7.297000 |
expr | min | lq | mean | median | uq | max | |
---|---|---|---|---|---|---|---|
1 | rowWeightedMeans | 1.000000 | 1.000000 | 1.000000 | 1.000000 | 1.000000 | 1.00000 |
2 | apply+weigthed.mean | 1.461435 | 1.450263 | 2.013932 | 1.436402 | 1.568251 | 27.00732 |
Figure: Benchmarking of colWeightedMeans() and apply+weigthed.mean() on 1000x10 data as well as rowWeightedMeans() and apply+weigthed.mean() on the same data transposed. Outliers are displayed as crosses. Times are in milliseconds. |
Table: Benchmarking of colWeightedMeans() and rowWeightedMeans() on 1000x10 data (original and transposed). The top panel shows times in milliseconds and the bottom panel shows relative times.
expr | min | lq | mean | median | uq | max | |
---|---|---|---|---|---|---|---|
1 | colWeightedMeans | 39.137 | 41.3845 | 44.80899 | 43.1425 | 44.428 | 127.886 |
2 | rowWeightedMeans | 127.435 | 135.0745 | 148.66137 | 140.5780 | 152.598 | 270.186 |
expr | min | lq | mean | median | uq | max | |
---|---|---|---|---|---|---|---|
1 | colWeightedMeans | 1.000000 | 1.000000 | 1.000000 | 1.000000 | 1.000000 | 1.00000 |
2 | rowWeightedMeans | 3.256126 | 3.263891 | 3.317668 | 3.258457 | 3.434726 | 2.11271 |
Figure: Benchmarking of colWeightedMeans() and rowWeightedMeans() on 1000x10 data (original and transposed). Outliers are displayed as crosses. Times are in milliseconds. |
> X <- data[["10x1000"]]
> w <- runif(nrow(X))
> gc()
used (Mb) gc trigger (Mb) max used (Mb)
Ncells 3058964 163.4 5723390 305.7 5723390 305.7
Vcells 5199884 39.7 12256490 93.6 12256404 93.6
> colStats <- microbenchmark(colWeightedMeans = colWeightedMeans(X, w = w, na.rm = FALSE), `apply+weigthed.mean` = apply(X,
+ MARGIN = 2L, FUN = weighted.mean, w = w, na.rm = FALSE), unit = "ms")
> X <- t(X)
> gc()
used (Mb) gc trigger (Mb) max used (Mb)
Ncells 3058958 163.4 5723390 305.7 5723390 305.7
Vcells 5209927 39.8 12256490 93.6 12256404 93.6
> rowStats <- microbenchmark(rowWeightedMeans = rowWeightedMeans(X, w = w, na.rm = FALSE), `apply+weigthed.mean` = apply(X,
+ MARGIN = 1L, FUN = weighted.mean, w = w, na.rm = FALSE), unit = "ms")
Table: Benchmarking of colWeightedMeans() and apply+weigthed.mean() on 10x1000 data. The top panel shows times in milliseconds and the bottom panel shows relative times.
expr | min | lq | mean | median | uq | max | |
---|---|---|---|---|---|---|---|
1 | colWeightedMeans | 0.027348 | 0.029787 | 0.0382364 | 0.033169 | 0.042577 | 0.077716 |
2 | apply+weigthed.mean | 4.284069 | 4.532933 | 4.7666648 | 4.698467 | 4.802924 | 8.797192 |
expr | min | lq | mean | median | uq | max | |
---|---|---|---|---|---|---|---|
1 | colWeightedMeans | 1.0000 | 1.0000 | 1.0000 | 1.0000 | 1.0000 | 1.0000 |
2 | apply+weigthed.mean | 156.6502 | 152.1782 | 124.6631 | 141.6524 | 112.8056 | 113.1967 |
Table: Benchmarking of rowWeightedMeans() and apply+weigthed.mean() on 10x1000 data (transposed). The top panel shows times in milliseconds and the bottom panel shows relative times. |
expr | min | lq | mean | median | uq | max | |
---|---|---|---|---|---|---|---|
1 | rowWeightedMeans | 0.100331 | 0.105250 | 0.1215451 | 0.114495 | 0.1278195 | 0.253728 |
2 | apply+weigthed.mean | 4.315044 | 4.649039 | 5.2149345 | 5.032358 | 5.4836465 | 10.441042 |
expr | min | lq | mean | median | uq | max | |
---|---|---|---|---|---|---|---|
1 | rowWeightedMeans | 1.00000 | 1.00000 | 1.00000 | 1.00000 | 1.00000 | 1.00000 |
2 | apply+weigthed.mean | 43.00808 | 44.17139 | 42.90534 | 43.95265 | 42.90149 | 41.15053 |
Figure: Benchmarking of colWeightedMeans() and apply+weigthed.mean() on 10x1000 data as well as rowWeightedMeans() and apply+weigthed.mean() on the same data transposed. Outliers are displayed as crosses. Times are in milliseconds. |
Table: Benchmarking of colWeightedMeans() and rowWeightedMeans() on 10x1000 data (original and transposed). The top panel shows times in milliseconds and the bottom panel shows relative times.
expr | min | lq | mean | median | uq | max | |
---|---|---|---|---|---|---|---|
1 | colWeightedMeans | 27.348 | 29.787 | 38.23638 | 33.169 | 42.5770 | 77.716 |
2 | rowWeightedMeans | 100.331 | 105.250 | 121.54512 | 114.495 | 127.8195 | 253.728 |
expr | min | lq | mean | median | uq | max | |
---|---|---|---|---|---|---|---|
1 | colWeightedMeans | 1.000000 | 1.000000 | 1.000000 | 1.000000 | 1.000000 | 1.00000 |
2 | rowWeightedMeans | 3.668678 | 3.533421 | 3.178782 | 3.451868 | 3.002079 | 3.26481 |
Figure: Benchmarking of colWeightedMeans() and rowWeightedMeans() on 10x1000 data (original and transposed). Outliers are displayed as crosses. Times are in milliseconds. |
> X <- data[["100x1000"]]
> w <- runif(nrow(X))
> gc()
used (Mb) gc trigger (Mb) max used (Mb)
Ncells 3059155 163.4 5723390 305.7 5723390 305.7
Vcells 5200482 39.7 12256490 93.6 12256404 93.6
> colStats <- microbenchmark(colWeightedMeans = colWeightedMeans(X, w = w, na.rm = FALSE), `apply+weigthed.mean` = apply(X,
+ MARGIN = 2L, FUN = weighted.mean, w = w, na.rm = FALSE), unit = "ms")
> X <- t(X)
> gc()
used (Mb) gc trigger (Mb) max used (Mb)
Ncells 3059143 163.4 5723390 305.7 5723390 305.7
Vcells 5300515 40.5 12256490 93.6 12256483 93.6
> rowStats <- microbenchmark(rowWeightedMeans = rowWeightedMeans(X, w = w, na.rm = FALSE), `apply+weigthed.mean` = apply(X,
+ MARGIN = 1L, FUN = weighted.mean, w = w, na.rm = FALSE), unit = "ms")
Table: Benchmarking of colWeightedMeans() and apply+weigthed.mean() on 100x1000 data. The top panel shows times in milliseconds and the bottom panel shows relative times.
expr | min | lq | mean | median | uq | max | |
---|---|---|---|---|---|---|---|
1 | colWeightedMeans | 0.169048 | 0.1936865 | 0.3126021 | 0.2303125 | 0.249248 | 8.918898 |
2 | apply+weigthed.mean | 5.891669 | 6.0341635 | 7.2968635 | 6.2800045 | 7.139492 | 16.419671 |
expr | min | lq | mean | median | uq | max | |
---|---|---|---|---|---|---|---|
1 | colWeightedMeans | 1.00000 | 1.00000 | 1.00000 | 1.00000 | 1.00000 | 1.000000 |
2 | apply+weigthed.mean | 34.85205 | 31.15428 | 23.34234 | 27.26732 | 28.64413 | 1.840998 |
Table: Benchmarking of rowWeightedMeans() and apply+weigthed.mean() on 100x1000 data (transposed). The top panel shows times in milliseconds and the bottom panel shows relative times. |
expr | min | lq | mean | median | uq | max | |
---|---|---|---|---|---|---|---|
1 | rowWeightedMeans | 0.899577 | 0.922818 | 1.146632 | 1.064101 | 1.160436 | 9.403608 |
2 | apply+weigthed.mean | 5.627461 | 5.917683 | 7.582343 | 6.826339 | 7.660190 | 17.345934 |
expr | min | lq | mean | median | uq | max | |
---|---|---|---|---|---|---|---|
1 | rowWeightedMeans | 1.000000 | 1.000000 | 1.000000 | 1.000000 | 1.000000 | 1.000000 |
2 | apply+weigthed.mean | 6.255675 | 6.412622 | 6.612706 | 6.415124 | 6.601131 | 1.844604 |
Figure: Benchmarking of colWeightedMeans() and apply+weigthed.mean() on 100x1000 data as well as rowWeightedMeans() and apply+weigthed.mean() on the same data transposed. Outliers are displayed as crosses. Times are in milliseconds. |
Table: Benchmarking of colWeightedMeans() and rowWeightedMeans() on 100x1000 data (original and transposed). The top panel shows times in milliseconds and the bottom panel shows relative times.
expr | min | lq | mean | median | uq | max | |
---|---|---|---|---|---|---|---|
1 | colWeightedMeans | 169.048 | 193.6865 | 312.6021 | 230.3125 | 249.248 | 8918.898 |
2 | rowWeightedMeans | 899.577 | 922.8180 | 1146.6325 | 1064.1010 | 1160.436 | 9403.608 |
expr | min | lq | mean | median | uq | max | |
---|---|---|---|---|---|---|---|
1 | colWeightedMeans | 1.000000 | 1.000000 | 1.000000 | 1.000000 | 1.000000 | 1.000000 |
2 | rowWeightedMeans | 5.321429 | 4.764493 | 3.668025 | 4.620249 | 4.655748 | 1.054346 |
Figure: Benchmarking of colWeightedMeans() and rowWeightedMeans() on 100x1000 data (original and transposed). Outliers are displayed as crosses. Times are in milliseconds. |
> X <- data[["1000x100"]]
> w <- runif(nrow(X))
> gc()
used (Mb) gc trigger (Mb) max used (Mb)
Ncells 3059334 163.4 5723390 305.7 5723390 305.7
Vcells 5202008 39.7 12256490 93.6 12256483 93.6
> colStats <- microbenchmark(colWeightedMeans = colWeightedMeans(X, w = w, na.rm = FALSE), `apply+weigthed.mean` = apply(X,
+ MARGIN = 2L, FUN = weighted.mean, w = w, na.rm = FALSE), unit = "ms")
> X <- t(X)
> gc()
used (Mb) gc trigger (Mb) max used (Mb)
Ncells 3059328 163.4 5723390 305.7 5723390 305.7
Vcells 5302051 40.5 12256490 93.6 12256483 93.6
> rowStats <- microbenchmark(rowWeightedMeans = rowWeightedMeans(X, w = w, na.rm = FALSE), `apply+weigthed.mean` = apply(X,
+ MARGIN = 1L, FUN = weighted.mean, w = w, na.rm = FALSE), unit = "ms")
Table: Benchmarking of colWeightedMeans() and apply+weigthed.mean() on 1000x100 data. The top panel shows times in milliseconds and the bottom panel shows relative times.
expr | min | lq | mean | median | uq | max | |
---|---|---|---|---|---|---|---|
1 | colWeightedMeans | 0.199028 | 0.247153 | 0.3341222 | 0.262264 | 0.2901365 | 5.84241 |
2 | apply+weigthed.mean | 1.560997 | 1.906229 | 4.7343526 | 2.022565 | 2.2959090 | 231.17986 |
expr | min | lq | mean | median | uq | max | |
---|---|---|---|---|---|---|---|
1 | colWeightedMeans | 1.000000 | 1.000000 | 1.00000 | 1.000000 | 1.000000 | 1.00000 |
2 | apply+weigthed.mean | 7.843102 | 7.712747 | 14.16952 | 7.711943 | 7.913203 | 39.56926 |
Table: Benchmarking of rowWeightedMeans() and apply+weigthed.mean() on 1000x100 data (transposed). The top panel shows times in milliseconds and the bottom panel shows relative times. |
expr | min | lq | mean | median | uq | max | |
---|---|---|---|---|---|---|---|
1 | rowWeightedMeans | 0.923806 | 1.001466 | 1.101040 | 1.057818 | 1.106354 | 5.408107 |
2 | apply+weigthed.mean | 1.534959 | 1.665787 | 2.140142 | 1.748613 | 1.873480 | 6.275241 |
expr | min | lq | mean | median | uq | max | |
---|---|---|---|---|---|---|---|
1 | rowWeightedMeans | 1.00000 | 1.000000 | 1.000000 | 1.000000 | 1.000000 | 1.00000 |
2 | apply+weigthed.mean | 1.66156 | 1.663348 | 1.943746 | 1.653037 | 1.693381 | 1.16034 |
Figure: Benchmarking of colWeightedMeans() and apply+weigthed.mean() on 1000x100 data as well as rowWeightedMeans() and apply+weigthed.mean() on the same data transposed. Outliers are displayed as crosses. Times are in milliseconds. |
Table: Benchmarking of colWeightedMeans() and rowWeightedMeans() on 1000x100 data (original and transposed). The top panel shows times in milliseconds and the bottom panel shows relative times.
expr | min | lq | mean | median | uq | max | |
---|---|---|---|---|---|---|---|
1 | colWeightedMeans | 199.028 | 247.153 | 334.1222 | 262.264 | 290.1365 | 5842.410 |
2 | rowWeightedMeans | 923.806 | 1001.466 | 1101.0402 | 1057.819 | 1106.3545 | 5408.107 |
expr | min | lq | mean | median | uq | max | |
---|---|---|---|---|---|---|---|
1 | colWeightedMeans | 1.000000 | 1.000000 | 1.000000 | 1.000000 | 1.000000 | 1.0000000 |
2 | rowWeightedMeans | 4.641588 | 4.052008 | 3.295321 | 4.033411 | 3.813221 | 0.9256637 |
Figure: Benchmarking of colWeightedMeans() and rowWeightedMeans() on 1000x100 data (original and transposed). Outliers are displayed as crosses. Times are in milliseconds. |
R version 3.6.1 Patched (2019-08-27 r77078)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Ubuntu 18.04.3 LTS
Matrix products: default
BLAS: /home/hb/software/R-devel/R-3-6-branch/lib/R/lib/libRblas.so
LAPACK: /home/hb/software/R-devel/R-3-6-branch/lib/R/lib/libRlapack.so
locale:
[1] LC_CTYPE=en_US.UTF-8 LC_NUMERIC=C
[3] LC_TIME=en_US.UTF-8 LC_COLLATE=en_US.UTF-8
[5] LC_MONETARY=en_US.UTF-8 LC_MESSAGES=en_US.UTF-8
[7] LC_PAPER=en_US.UTF-8 LC_NAME=C
[9] LC_ADDRESS=C LC_TELEPHONE=C
[11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] microbenchmark_1.4-6 matrixStats_0.55.0-9000 ggplot2_3.2.1
[4] knitr_1.24 R.devices_2.16.0 R.utils_2.9.0
[7] R.oo_1.22.0 R.methodsS3_1.7.1 history_0.0.0-9002
loaded via a namespace (and not attached):
[1] Biobase_2.45.0 bit64_0.9-7 splines_3.6.1
[4] network_1.15 assertthat_0.2.1 highr_0.8
[7] stats4_3.6.1 blob_1.2.0 robustbase_0.93-5
[10] pillar_1.4.2 RSQLite_2.1.2 backports_1.1.4
[13] lattice_0.20-38 glue_1.3.1 digest_0.6.20
[16] colorspace_1.4-1 sandwich_2.5-1 Matrix_1.2-17
[19] XML_3.98-1.20 lpSolve_5.6.13.3 pkgconfig_2.0.2
[22] genefilter_1.66.0 purrr_0.3.2 ergm_3.10.4
[25] xtable_1.8-4 mvtnorm_1.0-11 scales_1.0.0
[28] tibble_2.1.3 annotate_1.62.0 IRanges_2.18.2
[31] TH.data_1.0-10 withr_2.1.2 BiocGenerics_0.30.0
[34] lazyeval_0.2.2 mime_0.7 survival_2.44-1.1
[37] magrittr_1.5 crayon_1.3.4 statnet.common_4.3.0
[40] memoise_1.1.0 laeken_0.5.0 R.cache_0.13.0
[43] MASS_7.3-51.4 R.rsp_0.43.1 tools_3.6.1
[46] multcomp_1.4-10 S4Vectors_0.22.1 trust_0.1-7
[49] munsell_0.5.0 AnnotationDbi_1.46.1 compiler_3.6.1
[52] rlang_0.4.0 grid_3.6.1 RCurl_1.95-4.12
[55] cwhmisc_6.6 rappdirs_0.3.1 labeling_0.3
[58] bitops_1.0-6 base64enc_0.1-3 boot_1.3-23
[61] gtable_0.3.0 codetools_0.2-16 DBI_1.0.0
[64] markdown_1.1 R6_2.4.0 zoo_1.8-6
[67] dplyr_0.8.3 bit_1.1-14 zeallot_0.1.0
[70] parallel_3.6.1 Rcpp_1.0.2 vctrs_0.2.0
[73] DEoptimR_1.0-8 tidyselect_0.2.5 xfun_0.9
[76] coda_0.19-3
Total processing time was 14.99 secs.
To reproduce this report, do:
html <- matrixStats:::benchmark('colWeightedMeans')
Copyright Henrik Bengtsson. Last updated on 2019-09-10 18:36:13 (-0700 UTC). Powered by RSP.
<script> var link = document.createElement('link'); link.rel = 'icon'; link.href = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAMAAABEpIrGAAAA21BMVEUAAAAAAP8AAP8AAP8AAP8AAP8AAP8AAP8AAP8AAP8AAP8AAP8AAP8AAP8AAP8AAP8AAP8AAP8AAP8AAP8AAP8AAP8AAP8AAP8AAP8AAP8AAP8AAP8AAP8AAP8AAP8AAP8AAP8AAP8AAP8AAP8AAP8AAP8AAP8AAP8AAP8AAP8BAf4CAv0DA/wdHeIeHuEfH+AgIN8hId4lJdomJtknJ9g+PsE/P8BAQL9yco10dIt1dYp3d4h4eIeVlWqWlmmXl2iYmGeZmWabm2Tn5xjo6Bfp6Rb39wj4+Af//wA2M9hbAAAASXRSTlMAAQIJCgsMJSYnKD4/QGRlZmhpamtsbautrrCxuru8y8zN5ebn6Pn6+///////////////////////////////////////////LsUNcQAAAS9JREFUOI29k21XgkAQhVcFytdSMqMETU26UVqGmpaiFbL//xc1cAhhwVNf6n5i5z67M2dmYOyfJZUqlVLhkKucG7cgmUZTybDz6g0iDeq51PUr37Ds2cy2/C9NeES5puDjxuUk1xnToZsg8pfA3avHQ3lLIi7iWRrkv/OYtkScxBIMgDee0ALoyxHQBJ68JLCjOtQIMIANF7QG9G9fNnHvisCHBVMKgSJgiz7nE+AoBKrAPA3MgepvgR9TSCasrCKH0eB1wBGBFdCO+nAGjMVGPcQb5bd6mQRegN6+1axOs9nGfYcCtfi4NQosdtH7dB+txFIpXQqN1p9B/asRHToyS0jRgpV7nk4nwcq1BJ+x3Gl/v7S9Wmpp/aGquum7w3ZDyrADFYrl8vHBH+ev9AUASW1dmU4h4wAAAABJRU5ErkJggg==" document.getElementsByTagName('head')[0].appendChild(link); </script>