From 3f6ce570824616f5be0d6289ed65910d455dd266 Mon Sep 17 00:00:00 2001 From: Johannes Ranke Date: Thu, 17 Nov 2016 22:56:30 +0100 Subject: Rebuild --- vignettes/FOCUS_L.html | 64 ++++++++++++++++++++--------------------- vignettes/FOCUS_Z.pdf | Bin 239558 -> 239558 bytes vignettes/compiled_models.html | 51 ++++++++++++++++---------------- vignettes/mkin.html | 10 +++---- 4 files changed, 63 insertions(+), 62 deletions(-) (limited to 'vignettes') diff --git a/vignettes/FOCUS_L.html b/vignettes/FOCUS_L.html index bcdee8df..0d96fd5f 100644 --- a/vignettes/FOCUS_L.html +++ b/vignettes/FOCUS_L.html @@ -244,15 +244,15 @@ FOCUS_2006_L1_mkin <- mkin_wide_to_long(FOCUS_2006_L1) summary(m.L1.SFO)
## mkin version:    0.9.44.9000 
 ## R version:       3.3.2 
-## Date of fit:     Thu Nov 17 17:46:04 2016 
-## Date of summary: Thu Nov 17 17:46:04 2016 
+## Date of fit:     Thu Nov 17 18:44:25 2016 
+## Date of summary: Thu Nov 17 18:44:25 2016 
 ## 
 ## Equations:
-## d_parent = - k_parent_sink * parent
+## d_parent/dt = - k_parent_sink * parent
 ## 
 ## Model predictions using solution type analytical 
 ## 
-## Fitted with method Port using 37 model solutions performed in 0.093 s
+## Fitted with method Port using 37 model solutions performed in 0.088 s
 ## 
 ## Weighting: none
 ## 
@@ -337,8 +337,8 @@ summary(m.L1.SFO)
summary(m.L1.FOMC, data = FALSE)
## mkin version:    0.9.44.9000 
 ## R version:       3.3.2 
-## Date of fit:     Thu Nov 17 17:46:05 2016 
-## Date of summary: Thu Nov 17 17:46:05 2016 
+## Date of fit:     Thu Nov 17 18:44:26 2016 
+## Date of summary: Thu Nov 17 18:44:26 2016 
 ## 
 ## 
 ## Warning: Optimisation by method Port did not converge.
@@ -346,11 +346,11 @@ summary(m.L1.SFO)
## ## ## Equations: -## d_parent = - (alpha/beta) * 1/((time/beta) + 1) * parent +## d_parent/dt = - (alpha/beta) * 1/((time/beta) + 1) * parent ## ## Model predictions using solution type analytical ## -## Fitted with method Port using 188 model solutions performed in 0.456 s +## Fitted with method Port using 188 model solutions performed in 0.431 s ## ## Weighting: none ## @@ -434,15 +434,15 @@ plot(m.L2.FOMC, show_residuals = TRUE,
summary(m.L2.FOMC, data = FALSE)
## mkin version:    0.9.44.9000 
 ## R version:       3.3.2 
-## Date of fit:     Thu Nov 17 17:46:06 2016 
-## Date of summary: Thu Nov 17 17:46:06 2016 
+## Date of fit:     Thu Nov 17 18:44:26 2016 
+## Date of summary: Thu Nov 17 18:44:26 2016 
 ## 
 ## Equations:
-## d_parent = - (alpha/beta) * 1/((time/beta) + 1) * parent
+## d_parent/dt = - (alpha/beta) * 1/((time/beta) + 1) * parent
 ## 
 ## Model predictions using solution type analytical 
 ## 
-## Fitted with method Port using 81 model solutions performed in 0.227 s
+## Fitted with method Port using 81 model solutions performed in 0.18 s
 ## 
 ## Weighting: none
 ## 
@@ -504,17 +504,17 @@ plot(m.L2.DFOP, show_residuals = TRUE, show_errmin = TRUE,
 
summary(m.L2.DFOP, data = FALSE)
## mkin version:    0.9.44.9000 
 ## R version:       3.3.2 
-## Date of fit:     Thu Nov 17 17:46:07 2016 
-## Date of summary: Thu Nov 17 17:46:07 2016 
+## Date of fit:     Thu Nov 17 18:44:27 2016 
+## Date of summary: Thu Nov 17 18:44:27 2016 
 ## 
 ## Equations:
-## d_parent = - ((k1 * g * exp(-k1 * time) + k2 * (1 - g) * exp(-k2 *
-##            time)) / (g * exp(-k1 * time) + (1 - g) * exp(-k2 *
-##            time))) * parent
+## d_parent/dt = - ((k1 * g * exp(-k1 * time) + k2 * (1 - g) *
+##            exp(-k2 * time)) / (g * exp(-k1 * time) + (1 - g) *
+##            exp(-k2 * time))) * parent
 ## 
 ## Model predictions using solution type analytical 
 ## 
-## Fitted with method Port using 336 model solutions performed in 0.935 s
+## Fitted with method Port using 336 model solutions performed in 0.768 s
 ## 
 ## Weighting: none
 ## 
@@ -593,17 +593,17 @@ plot(mm.L3)
summary(mm.L3[["DFOP", 1]])
## mkin version:    0.9.44.9000 
 ## R version:       3.3.2 
-## Date of fit:     Thu Nov 17 17:46:08 2016 
-## Date of summary: Thu Nov 17 17:46:08 2016 
+## Date of fit:     Thu Nov 17 18:44:28 2016 
+## Date of summary: Thu Nov 17 18:44:28 2016 
 ## 
 ## Equations:
-## d_parent = - ((k1 * g * exp(-k1 * time) + k2 * (1 - g) * exp(-k2 *
-##            time)) / (g * exp(-k1 * time) + (1 - g) * exp(-k2 *
-##            time))) * parent
+## d_parent/dt = - ((k1 * g * exp(-k1 * time) + k2 * (1 - g) *
+##            exp(-k2 * time)) / (g * exp(-k1 * time) + (1 - g) *
+##            exp(-k2 * time))) * parent
 ## 
 ## Model predictions using solution type analytical 
 ## 
-## Fitted with method Port using 137 model solutions performed in 0.332 s
+## Fitted with method Port using 137 model solutions performed in 0.313 s
 ## 
 ## Weighting: none
 ## 
@@ -693,15 +693,15 @@ plot(mm.L4)
summary(mm.L4[["SFO", 1]], data = FALSE)
## mkin version:    0.9.44.9000 
 ## R version:       3.3.2 
-## Date of fit:     Thu Nov 17 17:46:08 2016 
-## Date of summary: Thu Nov 17 17:46:08 2016 
+## Date of fit:     Thu Nov 17 18:44:28 2016 
+## Date of summary: Thu Nov 17 18:44:29 2016 
 ## 
 ## Equations:
-## d_parent = - k_parent_sink * parent
+## d_parent/dt = - k_parent_sink * parent
 ## 
 ## Model predictions using solution type analytical 
 ## 
-## Fitted with method Port using 46 model solutions performed in 0.131 s
+## Fitted with method Port using 46 model solutions performed in 0.1 s
 ## 
 ## Weighting: none
 ## 
@@ -753,15 +753,15 @@ plot(mm.L4)
summary(mm.L4[["FOMC", 1]], data = FALSE)
## mkin version:    0.9.44.9000 
 ## R version:       3.3.2 
-## Date of fit:     Thu Nov 17 17:46:08 2016 
-## Date of summary: Thu Nov 17 17:46:08 2016 
+## Date of fit:     Thu Nov 17 18:44:28 2016 
+## Date of summary: Thu Nov 17 18:44:29 2016 
 ## 
 ## Equations:
-## d_parent = - (alpha/beta) * 1/((time/beta) + 1) * parent
+## d_parent/dt = - (alpha/beta) * 1/((time/beta) + 1) * parent
 ## 
 ## Model predictions using solution type analytical 
 ## 
-## Fitted with method Port using 66 model solutions performed in 0.167 s
+## Fitted with method Port using 66 model solutions performed in 0.152 s
 ## 
 ## Weighting: none
 ## 
diff --git a/vignettes/FOCUS_Z.pdf b/vignettes/FOCUS_Z.pdf
index 6f71d018..6f8929ea 100644
Binary files a/vignettes/FOCUS_Z.pdf and b/vignettes/FOCUS_Z.pdf differ
diff --git a/vignettes/compiled_models.html b/vignettes/compiled_models.html
index dc2b2ca7..2cb73ac7 100644
--- a/vignettes/compiled_models.html
+++ b/vignettes/compiled_models.html
@@ -11,7 +11,7 @@
 
 
 
-
+
 
 Performance benefit by using compiled model definitions in mkin
 
@@ -216,7 +216,7 @@ div.tocify {
 
 

Performance benefit by using compiled model definitions in mkin

Johannes Ranke

-

2016-11-04

+

2016-11-17

@@ -232,6 +232,7 @@ div.tocify {
## Loading required package: minpack.lm
## Loading required package: rootSolve
## Loading required package: inline
+
## Loading required package: methods
## Loading required package: parallel
SFO_SFO <- mkinmod(
   parent = mkinsub("SFO", "m1"),
@@ -241,12 +242,12 @@ div.tocify {
 
library("microbenchmark")
 library("ggplot2")
 mb.1 <- microbenchmark(
-  "deSolve, not compiled" = mkinfit(SFO_SFO, FOCUS_2006_D, 
-                                    solution_type = "deSolve", 
+  "deSolve, not compiled" = mkinfit(SFO_SFO, FOCUS_2006_D,
+                                    solution_type = "deSolve",
                                     use_compiled = FALSE, quiet = TRUE),
-  "Eigenvalue based" = mkinfit(SFO_SFO, FOCUS_2006_D, 
+  "Eigenvalue based" = mkinfit(SFO_SFO, FOCUS_2006_D,
                                solution_type = "eigen", quiet = TRUE),
-  "deSolve, compiled" = mkinfit(SFO_SFO, FOCUS_2006_D, 
+  "deSolve, compiled" = mkinfit(SFO_SFO, FOCUS_2006_D,
                                 solution_type = "deSolve", quiet = TRUE),
   times = 3, control = list(warmup = 0))
## Warning in microbenchmark(`deSolve, not compiled` = mkinfit(SFO_SFO,
@@ -256,21 +257,21 @@ mb.1 <- microbenchmark(
 print(mb.1)
## Unit: milliseconds
 ##                   expr       min        lq      mean    median        uq
-##  deSolve, not compiled 4969.1274 5005.4703 5026.1990 5041.8132 5054.7348
-##       Eigenvalue based  841.6273  843.3144  855.0880  845.0015  861.8183
-##      deSolve, compiled  689.6154  698.2345  710.3162  706.8537  720.6666
+##  deSolve, not compiled 4925.0009 4957.6694 4974.0652 4990.3379 4998.5974
+##       Eigenvalue based  838.9741  839.6651  857.4679  840.3561  866.7149
+##      deSolve, compiled  695.5858  709.3905  717.8062  723.1951  728.9163
 ##        max neval cld
-##  5067.6564     3   c
-##   878.6352     3  b 
-##   734.4795     3 a
+## 5006.8569 3 c +## 893.0736 3 b +## 734.6375 3 a
autoplot(mb.1)
-

-

We see that using the compiled model is by a factor of 7.1 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:

+

+

We see that using the compiled model is by a factor of 6.9 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:

rownames(smb.1) <- smb.1$expr
 smb.1["median"]/smb.1["deSolve, compiled", "median"]
##                         median
-## deSolve, not compiled 7.132754
-## Eigenvalue based      1.195441
+## deSolve, not compiled 6.900403
+## Eigenvalue based      1.162005
 ## deSolve, compiled     1.000000
@@ -281,7 +282,7 @@ smb.1["median"]/smb.1["deSolve, compiled", "median" m1 = mkinsub( "SFO"))
## Successfully compiled differential equation model from auto-generated C code.
mb.2 <- microbenchmark(
-  "deSolve, not compiled" = mkinfit(FOMC_SFO, FOCUS_2006_D, 
+  "deSolve, not compiled" = mkinfit(FOMC_SFO, FOCUS_2006_D,
                                     use_compiled = FALSE, quiet = TRUE),
   "deSolve, compiled" = mkinfit(FOMC_SFO, FOCUS_2006_D, quiet = TRUE),
   times = 3, control = list(warmup = 0))
@@ -291,19 +292,19 @@ smb.1["median"]/smb.1["deSolve, compiled", "median"
smb.2 <- summary(mb.2)
 print(mb.2)
## Unit: seconds
-##                   expr       min        lq      mean    median        uq
-##  deSolve, not compiled 10.998190 11.039105 11.133751 11.080019 11.201531
-##      deSolve, compiled  1.286159  1.286381  1.288394  1.286602  1.289511
-##       max neval cld
-##  11.32304     3   b
-##   1.29242     3  a
+## expr min lq mean median uq +## deSolve, not compiled 10.905262 11.007527 11.335389 11.109791 11.55045 +## deSolve, compiled 1.297428 1.304999 1.327356 1.312569 1.34232 +## max neval cld +## 11.991114 3 b +## 1.372071 3 a
smb.2["median"]/smb.2["deSolve, compiled", "median"]
##   median
 ## 1     NA
 ## 2     NA
autoplot(mb.2)
-

-

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

+

+

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

This vignette was built with mkin 0.9.44.9000 on

## R version 3.3.2 (2016-10-31)
 ## Platform: x86_64-pc-linux-gnu (64-bit)
diff --git a/vignettes/mkin.html b/vignettes/mkin.html
index 172712f5..a8f7f2ba 100644
--- a/vignettes/mkin.html
+++ b/vignettes/mkin.html
@@ -246,23 +246,23 @@ div.tocify {
 # Define the kinetic model
 m_SFO_SFO_SFO <- mkinmod(parent = mkinsub("SFO", "M1"),
                          M1 = mkinsub("SFO", "M2"),
-                         M2 = mkinsub("SFO"), 
+                         M2 = mkinsub("SFO"),
                          use_of_ff = "max", quiet = TRUE)
 
 
 # Produce model predictions using some arbitrary parameters
 sampling_times = c(0, 1, 3, 7, 14, 28, 60, 90, 120)
 d_SFO_SFO_SFO <- mkinpredict(m_SFO_SFO_SFO,
-  c(k_parent = 0.03, 
-    f_parent_to_M1 = 0.5, k_M1 = log(2)/100, 
+  c(k_parent = 0.03,
+    f_parent_to_M1 = 0.5, k_M1 = log(2)/100,
     f_M1_to_M2 = 0.9, k_M2 = log(2)/50),
   c(parent = 100, M1 = 0, M2 = 0),
   sampling_times)
 
-# Generate a dataset by adding normally distributed errors with 
+# Generate a dataset by adding normally distributed errors with
 # standard deviation 3, for two replicates at each sampling time
 d_SFO_SFO_SFO_err <- add_err(d_SFO_SFO_SFO, reps = 2,
-                             sdfunc = function(x) 3, 
+                             sdfunc = function(x) 3,
                              n = 1, seed = 123456789 )
 
 # Fit the model to the dataset
-- 
cgit v1.2.1