From 0bd507131a9bb180afe6e843681330956086be9b Mon Sep 17 00:00:00 2001 From: Johannes Ranke Date: Mon, 9 Nov 2015 09:35:15 +0100 Subject: Vignettes rebuilt by staticdocs::build_site() for static documentation on r-forge --- inst/web/Extract.mmkin.html | 24 ++--- inst/web/index.html | 1 + inst/web/mccall81_245T.html | 6 +- inst/web/mkinfit.html | 6 +- inst/web/mkinmod.html | 2 +- inst/web/mkinpredict.html | 6 +- inst/web/summary.mkinfit.html | 6 +- inst/web/transform_odeparms.html | 6 +- inst/web/vignettes/FOCUS_Z.pdf | Bin 224819 -> 224802 bytes inst/web/vignettes/compiled_models.html | 162 ++++++++++++++++++++++++++++++++ inst/web/vignettes/mkin.pdf | Bin 160268 -> 160268 bytes 11 files changed, 191 insertions(+), 28 deletions(-) create mode 100644 inst/web/vignettes/compiled_models.html (limited to 'inst') diff --git a/inst/web/Extract.mmkin.html b/inst/web/Extract.mmkin.html index 257445e1..c6ae3ef7 100644 --- a/inst/web/Extract.mmkin.html +++ b/inst/web/Extract.mmkin.html @@ -181,7 +181,7 @@ $calls $time user system elapsed - 0.264 0.000 0.264 + 0.260 0.000 0.262 $mkinmod <mkinmod> model generated with @@ -367,7 +367,7 @@ function (P) } return(mC) } -<environment: 0x3b41780> +<environment: 0x2a98780> $cost_notrans function (P) @@ -389,7 +389,7 @@ function (P) scaleVar = scaleVar) return(mC) } -<environment: 0x3b41780> +<environment: 0x2a98780> $hessian_notrans parent_0 alpha beta @@ -455,7 +455,7 @@ $bparms.state 99.66619 $date -[1] "Mon Nov 9 08:25:11 2015" +[1] "Mon Nov 9 09:05:53 2015" attr(,"class") [1] "mkinfit" "modFit" @@ -540,7 +540,7 @@ $calls $time user system elapsed - 0.100 0.000 0.101 + 0.088 0.000 0.086 $mkinmod <mkinmod> model generated with @@ -727,7 +727,7 @@ function (P) } return(mC) } -<environment: 0x3d4fdb8> +<environment: 0x2ca6db8> $cost_notrans function (P) @@ -749,7 +749,7 @@ function (P) scaleVar = scaleVar) return(mC) } -<environment: 0x3d4fdb8> +<environment: 0x2ca6db8> $hessian_notrans parent_0 k_parent_sink @@ -812,7 +812,7 @@ $bparms.state 99.17407 $date -[1] "Mon Nov 9 08:25:11 2015" +[1] "Mon Nov 9 09:05:53 2015" attr(,"class") [1] "mkinfit" "modFit" @@ -890,7 +890,7 @@ $calls $time user system elapsed - 0.100 0.000 0.101 + 0.088 0.000 0.086 $mkinmod <mkinmod> model generated with @@ -1077,7 +1077,7 @@ function (P) } return(mC) } -<environment: 0x3d4fdb8> +<environment: 0x2ca6db8> $cost_notrans function (P) @@ -1099,7 +1099,7 @@ function (P) scaleVar = scaleVar) return(mC) } -<environment: 0x3d4fdb8> +<environment: 0x2ca6db8> $hessian_notrans parent_0 k_parent_sink @@ -1162,7 +1162,7 @@ $bparms.state 99.17407 $date -[1] "Mon Nov 9 08:25:11 2015" +[1] "Mon Nov 9 09:05:53 2015" attr(,"class") [1] "mkinfit" "modFit" diff --git a/inst/web/index.html b/inst/web/index.html index a08af34f..71fdee45 100644 --- a/inst/web/index.html +++ b/inst/web/index.html @@ -419,6 +419,7 @@ You can also browse the source code at cgit.j

Vignettes

mkin version: 0.9.41 R version: 3.2.2 -Date of fit: Mon Nov 9 08:25:18 2015 -Date of summary: Mon Nov 9 08:25:18 2015 +Date of fit: Mon Nov 9 09:06:00 2015 +Date of summary: Mon Nov 9 09:06:00 2015 Equations: d_T245 = - k_T245_sink * T245 - k_T245_phenol * T245 @@ -124,7 +124,7 @@ d_anisole = + k_phenol_anisole * phenol - k_anisole_sink * anisole Model predictions using solution type deSolve -Fitted with method Port using 246 model solutions performed in 1.369 s +Fitted with method Port using 246 model solutions performed in 1.372 s Weighting: none diff --git a/inst/web/mkinfit.html b/inst/web/mkinfit.html index 8536925c..96bdf95f 100644 --- a/inst/web/mkinfit.html +++ b/inst/web/mkinfit.html @@ -317,8 +317,8 @@ summary(fit)
mkin version: 0.9.41 R version: 3.2.2 -Date of fit: Mon Nov 9 08:25:21 2015 -Date of summary: Mon Nov 9 08:25:21 2015 +Date of fit: Mon Nov 9 09:06:03 2015 +Date of summary: Mon Nov 9 09:06:03 2015 Equations: d_parent = - (alpha/beta) * 1/((time/beta) + 1) * parent @@ -401,7 +401,7 @@ print(system.time(fit <- mkinfit(SFO_SFO, FOCUS_2006_D, solution_type = "eigen", quiet = TRUE)))
user system elapsed - 1.176 1.204 0.894 + 1.180 1.196 0.889
coef(fit)
diff --git a/inst/web/mkinmod.html b/inst/web/mkinmod.html index 8d162cd8..797e96d5 100644 --- a/inst/web/mkinmod.html +++ b/inst/web/mkinmod.html @@ -183,7 +183,7 @@ SFO_SFO <- mkinmod( m1 = mkinsub("SFO"), verbose = TRUE)
Compilation argument: - /usr/lib/R/bin/R CMD SHLIB file5a355b71ca9.c 2> file5a355b71ca9.c.err.txt + /usr/lib/R/bin/R CMD SHLIB file16d352645eb9.c 2> file16d352645eb9.c.err.txt Program source: 1: #include <R.h> 2: diff --git a/inst/web/mkinpredict.html b/inst/web/mkinpredict.html index 9f229fd5..3a6300d0 100644 --- a/inst/web/mkinpredict.html +++ b/inst/web/mkinpredict.html @@ -304,7 +304,7 @@ 201 20 4.978707 27.46227
user system elapsed - 0.000 0.028 0.004 + 0.008 0.024 0.004
system.time( print(mkinpredict(SFO_SFO, c(k_parent_m1 = 0.05, k_parent_sink = 0.1, k_m1_sink = 0.01), @@ -315,7 +315,7 @@ 201 20 4.978707 27.46227
user system elapsed - 0.000 0.020 0.003 + 0.004 0.020 0.002
system.time( print(mkinpredict(SFO_SFO, c(k_parent_m1 = 0.05, k_parent_sink = 0.1, k_m1_sink = 0.01), @@ -326,7 +326,7 @@ 201 20 4.978707 27.46227
user system elapsed - 0.052 0.000 0.054 + 0.064 0.000 0.066
diff --git a/inst/web/summary.mkinfit.html b/inst/web/summary.mkinfit.html index fe129c49..02469bb6 100644 --- a/inst/web/summary.mkinfit.html +++ b/inst/web/summary.mkinfit.html @@ -159,15 +159,15 @@
mkin version: 0.9.41 R version: 3.2.2 -Date of fit: Mon Nov 9 08:25:31 2015 -Date of summary: Mon Nov 9 08:25:31 2015 +Date of fit: Mon Nov 9 09:06:13 2015 +Date of summary: Mon Nov 9 09:06:13 2015 Equations: d_parent = - k_parent_sink * parent Model predictions using solution type analytical -Fitted with method Port using 35 model solutions performed in 0.104 s +Fitted with method Port using 35 model solutions performed in 0.1 s Weighting: none diff --git a/inst/web/transform_odeparms.html b/inst/web/transform_odeparms.html index 2690f4c3..25dcaba9 100644 --- a/inst/web/transform_odeparms.html +++ b/inst/web/transform_odeparms.html @@ -135,8 +135,8 @@ summary(fit, data=FALSE) # See transformed and backtransformed parameters
mkin version: 0.9.41 R version: 3.2.2 -Date of fit: Mon Nov 9 08:25:33 2015 -Date of summary: Mon Nov 9 08:25:33 2015 +Date of fit: Mon Nov 9 09:06:14 2015 +Date of summary: Mon Nov 9 09:06:14 2015 Equations: d_parent = - k_parent_sink * parent - k_parent_m1 * parent @@ -144,7 +144,7 @@ d_m1 = + k_parent_m1 * parent - k_m1_sink * m1 Model predictions using solution type deSolve -Fitted with method Port using 153 model solutions performed in 0.626 s +Fitted with method Port using 153 model solutions performed in 0.619 s Weighting: none diff --git a/inst/web/vignettes/FOCUS_Z.pdf b/inst/web/vignettes/FOCUS_Z.pdf index a84b8c94..1234de20 100644 Binary files a/inst/web/vignettes/FOCUS_Z.pdf and b/inst/web/vignettes/FOCUS_Z.pdf differ diff --git a/inst/web/vignettes/compiled_models.html b/inst/web/vignettes/compiled_models.html new file mode 100644 index 00000000..92919da9 --- /dev/null +++ b/inst/web/vignettes/compiled_models.html @@ -0,0 +1,162 @@ + + + + + + + + + + + + + + +Performance benefit by using compiled model definitions in mkin + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + +
+

Benchmark for a model that can also be solved with Eigenvalues

+

This evaluation is taken from the example section of mkinfit. When using an mkin version equal to or greater than 0.9-36 and a C compiler (gcc) is available, you will see a message that the model is being compiled from autogenerated C code when defining a model using mkinmod. The mkinmod() function checks for presence of the gcc compiler using

+
Sys.which("gcc")
+
##            gcc 
+## "/usr/bin/gcc"
+

First, we build a simple degradation model for a parent compound with one metabolite.

+
library("mkin")
+SFO_SFO <- mkinmod(
+  parent = mkinsub("SFO", "m1"),
+  m1 = mkinsub("SFO"))
+
## Successfully compiled differential equation model from auto-generated C code.
+

We can compare the performance of the Eigenvalue based solution against the compiled version and the R implementation of the differential equations using the microbenchmark package.

+
library("microbenchmark")
+mb.1 <- microbenchmark(
+  mkinfit(SFO_SFO, FOCUS_2006_D, solution_type = "deSolve", use_compiled = FALSE, 
+          quiet = TRUE),
+  mkinfit(SFO_SFO, FOCUS_2006_D, solution_type = "eigen", quiet = TRUE),
+  mkinfit(SFO_SFO, FOCUS_2006_D, solution_type = "deSolve", quiet = TRUE),
+  times = 3, control = list(warmup = 1))
+smb.1 <- summary(mb.1)[-1]
+rownames(smb.1) <- c("deSolve, not compiled", "Eigenvalue based", "deSolve, compiled")
+print(smb.1)
+
##                             min        lq      mean    median        uq
+## deSolve, not compiled 9307.3194 9319.9546 9332.8171 9332.5899 9345.5659
+## Eigenvalue based       855.3608  855.8081  869.4725  856.2555  876.5283
+## deSolve, compiled      686.6143  687.9256  698.0279  689.2369  703.7346
+##                             max neval cld
+## deSolve, not compiled 9358.5420     3   c
+## Eigenvalue based       896.8012     3  b 
+## deSolve, compiled      718.2324     3 a
+

We see that using the compiled model is by a factor of 13.5 faster than using the R version with the default ode solver, and it is even faster than the Eigenvalue based solution implemented in R which does not need iterative solution of the ODEs:

+
smb.1["median"]/smb.1["deSolve, compiled", "median"]
+
##                          median
+## deSolve, not compiled 13.540468
+## Eigenvalue based       1.242324
+## deSolve, compiled      1.000000
+
+
+

Benchmark for a model that can not be solved with Eigenvalues

+

This evaluation is also taken from the example section of mkinfit.

+
FOMC_SFO <- mkinmod(
+  parent = mkinsub("FOMC", "m1"),
+  m1 = mkinsub( "SFO"))
+
## Successfully compiled differential equation model from auto-generated C code.
+
mb.2 <- microbenchmark(
+  mkinfit(FOMC_SFO, FOCUS_2006_D, use_compiled = FALSE, quiet = TRUE),
+  mkinfit(FOMC_SFO, FOCUS_2006_D, quiet = TRUE),
+  times = 3, control = list(warmup = 1))
+smb.2 <- summary(mb.2)[-1]
+rownames(smb.2) <- c("deSolve, not compiled", "deSolve, compiled")
+print(smb.2)
+
##                             min        lq      mean    median        uq
+## deSolve, not compiled 20.130709 20.147223 20.180429 20.163737 20.205289
+## deSolve, compiled      1.235864  1.255748  1.267458  1.275632  1.283255
+##                             max neval cld
+## deSolve, not compiled 20.246841     3   b
+## deSolve, compiled      1.290878     3  a
+
smb.2["median"]/smb.2["deSolve, compiled", "median"]
+
##                         median
+## deSolve, not compiled 15.80686
+## deSolve, compiled      1.00000
+

Here we get a performance benefit of a factor of 15.8 using the version of the differential equation model compiled from C code using the inline package!

+

This vignette was built with mkin 0.9.41 on

+
## R version 3.2.2 (2015-08-14)
+## Platform: x86_64-pc-linux-gnu (64-bit)
+## Running under: Debian GNU/Linux 8 (jessie)
+
## CPU model: Intel(R) Core(TM) i7-4710MQ CPU @ 2.50GHz
+
+ + +
+ + + + + + diff --git a/inst/web/vignettes/mkin.pdf b/inst/web/vignettes/mkin.pdf index ce628c0e..9c1a03f3 100644 Binary files a/inst/web/vignettes/mkin.pdf and b/inst/web/vignettes/mkin.pdf differ -- cgit v1.2.1