From 218a9c55bd80fb708b15fa7196422f759bfe4b27 Mon Sep 17 00:00:00 2001 From: Johannes Ranke Date: Wed, 13 May 2020 16:20:23 +0200 Subject: Further formatting improvement of benchmark vignette Also, use .rmd extension instead of .Rmd for vignettes. --- docs/articles/web_only/benchmarks.html | 146 ++++++++++++++------------------- 1 file changed, 61 insertions(+), 85 deletions(-) (limited to 'docs/articles') diff --git a/docs/articles/web_only/benchmarks.html b/docs/articles/web_only/benchmarks.html index b0bb5196..202ec25f 100644 --- a/docs/articles/web_only/benchmarks.html +++ b/docs/articles/web_only/benchmarks.html @@ -100,38 +100,21 @@

Benchmark timings for mkin

Johannes Ranke

-

2020-05-12

+

2020-05-13

- Source: vignettes/web_only/benchmarks.Rmd - + Source: vignettes/web_only/benchmarks.rmd + -

Each system is characterized by its CPU type, the operating system type and the mkin version. Currently only values for one system are available.

-
cpu_model <- benchmarkme::get_cpu()$model_name
-operating_system <- Sys.info()[["sysname"]]
-mkin_version <- as.character(packageVersion("mkin"))
-system_string <- paste0(operating_system, ", ", cpu_model, ", mkin version ", mkin_version)
-load("~/git/mkin/vignettes/web_only/mkin_benchmarks.rda")
-mkin_benchmarks[system_string, c("CPU", "OS", "mkin")] <-
-  c(cpu_model, operating_system, mkin_version)
-
-if (mkin_version > "0.9.48.1") {
-  mmkin_bench <- function(models, datasets, error_model = "const") {
-    mmkin(models, datasets, error_model = error_model, cores = 1, quiet = TRUE)
-  }
-} else {
-  mmkin_bench <- function(models, datasets, error_model = NULL) {
-    mmkin(models, datasets, reweight.method = error_model, cores = 1, quiet = TRUE)
-  }
-}
+

Each system is characterized by its CPU type, the operating system type and the mkin version. Currently only values for one system are available. A compiler was available, so if no analytical solution was available, compiled ODE models are used.

Test cases

Parent only:

-
FOCUS_C <- FOCUS_2006_C
+
FOCUS_C <- FOCUS_2006_C
 FOCUS_D <- subset(FOCUS_2006_D, value != 0)
 parent_datasets <- list(FOCUS_C, FOCUS_D)
 
@@ -139,25 +122,22 @@
 t2 <- system.time(mmkin_bench(c("SFO", "FOMC", "DFOP", "HS"), parent_datasets,
     error_model = "tc"))[["elapsed"]]

One metabolite:

-
SFO_SFO <- mkinmod(
+
SFO_SFO <- mkinmod(
   parent = mkinsub("SFO", "m1"),
-  m1 = mkinsub("SFO"))
-
## Successfully compiled differential equation model from auto-generated C code.
-
FOMC_SFO <- mkinmod(
+  m1 = mkinsub("SFO"))
+FOMC_SFO <- mkinmod(
   parent = mkinsub("FOMC", "m1"),
-  m1 = mkinsub("SFO"))
-
## Successfully compiled differential equation model from auto-generated C code.
-
DFOP_SFO <- mkinmod(
+  m1 = mkinsub("SFO"))
+DFOP_SFO <- mkinmod(
   parent = mkinsub("FOMC", "m1"),
-  m1 = mkinsub("SFO"))
-
## Successfully compiled differential equation model from auto-generated C code.
-
t3 <- system.time(mmkin_bench(list(SFO_SFO, FOMC_SFO, DFOP_SFO), list(FOCUS_D)))[["elapsed"]]
+  m1 = mkinsub("SFO"))
+t3 <- system.time(mmkin_bench(list(SFO_SFO, FOMC_SFO, DFOP_SFO), list(FOCUS_D)))[["elapsed"]]
 t4 <- system.time(mmkin_bench(list(SFO_SFO, FOMC_SFO, DFOP_SFO), list(FOCUS_D),
     error_model = "tc"))[["elapsed"]]
 t5 <- system.time(mmkin_bench(list(SFO_SFO, FOMC_SFO, DFOP_SFO), list(FOCUS_D),
     error_model = "obs"))[["elapsed"]]

Two metabolites, synthetic data:

-
m_synth_SFO_lin <- mkinmod(parent = mkinsub("SFO", "M1"),
+
m_synth_SFO_lin <- mkinmod(parent = mkinsub("SFO", "M1"),
                            M1 = mkinsub("SFO", "M2"),
                            M2 = mkinsub("SFO"),
                            use_of_ff = "max", quiet = TRUE)
@@ -183,57 +163,55 @@
     error_model = "obs"))[["elapsed"]]
 t11 <- system.time(mmkin_bench(list(m_synth_DFOP_par), list(DFOP_par_c),
     error_model = "obs"))[["elapsed"]]
-
mkin_benchmarks[system_string, paste0("t", 1:11)] <-
+
mkin_benchmarks[system_string, paste0("t", 1:11)] <-
   c(t1, t2, t3, t4, t5, t6, t7, t8, t9, t10, t11)
 save(mkin_benchmarks, file = "~/git/mkin/vignettes/web_only/mkin_benchmarks.rda")

Results

-

Currently, we only have benchmark information on one system, therefore only the mkin version is shown with the results below. Timings are in seconds, shorter is better.

-
rownames(mkin_benchmarks) <- as.character(mkin_benchmarks$mkin)
+

Currently, we only have benchmark information on one system, therefore only the mkin version is shown with the results below. Timings are in seconds, shorter is better. All results were obtained by serial, i.e. not using multiple computing cores.

Benchmarks for all available error models are shown.

Parent only

-

Constant variance and two-component error model:

-
kable(mkin_benchmarks[, c("t1", "t2")])
+

Constant variance (t1) and two-component error model (t2) for four models fitted to two datasets, i.e. eight fits for each test.

- - - + + + - + - + - + - + - + - - - + + +
t1t2mkin versiont1 [s]t2 [s]
0.9.48.10.9.48.1 3.610 11.019
0.9.49.10.9.49.1 8.184 22.889
0.9.49.20.9.49.2 7.064 12.558
0.9.49.30.9.49.3 7.296 21.239
0.9.49.40.9.49.4 5.936 20.545
0.9.50.21.6593.9000.9.50.21.7043.909
@@ -241,51 +219,50 @@

One metabolite

-

Constant variance, variance by variable and two-component error model:

-
kable(mkin_benchmarks[, c("t3", "t4", "t5")])
+

Constant variance (t3), two-component error model (t4), and variance by variable (t5) for three models fitted to one dataset, i.e. three fits for each test.

- - - - + + + + - + - + - + - + - + - - - - + + + +
t3t4t5mkin versiont3 [s]t4 [s]t5 [s]
0.9.48.10.9.48.1 3.764 14.347 9.495
0.9.49.10.9.49.1 4.649 13.789 6.395
0.9.49.20.9.49.2 4.786 8.461 5.675
0.9.49.30.9.49.3 4.510 13.805 7.386
0.9.49.40.9.49.4 4.446 15.335 6.002
0.9.50.21.3896.1062.7160.9.50.21.3706.1472.747
@@ -293,21 +270,20 @@

Two metabolites

-

Two different datasets, for each constant variance, variance by variable and two-component error model are shown:

-
kable(mkin_benchmarks[, paste0("t", 6:11)])
+

Constant variance (t6 and t7), two-component error model (t8 and t9), and variance by variable (t10 and t11) for one model fitted to one dataset, i.e. one fit for each test.

- - - - - - - + + + + + + + - + @@ -316,7 +292,7 @@ - + @@ -325,7 +301,7 @@ - + @@ -334,7 +310,7 @@ - + @@ -343,7 +319,7 @@ - + @@ -352,13 +328,13 @@ - - - - - - - + + + + + + +
t6t7t8t9t10t11mkin versiont6 [s]t7 [s]t8 [s]t9 [s]t10 [s]t11 [s]
0.9.48.10.9.48.1 2.623 4.587 7.52531.267
0.9.49.10.9.49.1 2.542 4.128 4.6325.636
0.9.49.20.9.49.2 2.723 4.478 4.8625.574
0.9.49.30.9.49.3 2.643 4.374 7.0207.365
0.9.49.40.9.49.4 2.635 4.259 4.7375.626
0.9.50.20.7511.2091.2702.8592.0262.9630.9.50.20.7611.2131.2872.8862.0542.984
-- cgit v1.2.1