View source: R/BenchmarkRvsCpp.R
| MiniBenchmarkRvsCpp | R Documentation | 
Evaluate the likelihood calculation times for example trees and data
MiniBenchmarkRvsCpp(
  data = PCMBaseCpp::benchmarkData,
  includeR = TRUE,
  includeTransformationTime = TRUE,
  nRepsCpp = 10L,
  listOptions = list(PCMBase.Lmr.mode = 11, PCMBase.Threshold.EV = 0,
    PCMBase.Threshold.SV = 0),
  doProf = FALSE,
  RprofR.out = "RprofR.out",
  RprofCpp.out = "RprofCpp.out"
)
| data | a 'data.frame' with at least the following columns: 
 Defaults: to 'benchmarkData', which is small data.table included with the PCMBaseCpp package. | 
| includeR | logical (default TRUE) indicating if likelihood calculations in R should be included in the benchmark (can be slow). | 
| includeTransformationTime | logical (default TRUE) indicating if the time for
 | 
| nRepsCpp | : number of repetitions for the cpp likelihood calculation calls: a bigger value increases the precision of time estimation at the expense of longer running time for the benchmark. Defaults to 10. | 
| listOptions | options to set before measuring the calculation times. Defaults to 'list(PCMBase.Lmr.mode = 11, PCMBase.Threshold.EV = 0, PCMBase.Threshold.SV = 0)'. 'PCMBase.Lmr.mode' corresponds to the parallel traversal mode for the tree traversal algorithm (see this page for possible values). | 
| doProf | logical indicating if profiling should be activated (see Rprof
from the utils R-package). Default: FALSE. Additional arguments to Rprof can 
be specified by assigning lists of arguments to the options 'PCMBaseCpp.ArgsRprofR'
and 'PCMBaseCpp.ArgsRprofCpp'. The default values for both options is
 | 
| RprofR.out,RprofCpp.out | character strings indicating Rprof.out files for the R and Cpp implementations; ignored if doProf is FALSE. Default values: 'RprofR.out' and 'Rprofcpp.out'. | 
a data.frame.
library(PCMBase)
library(PCMBaseCpp)
library(data.table)
testData <- PCMBaseCpp::benchmarkData[1]
# original MGPM model
MiniBenchmarkRvsCpp(data = testData)
# original MGPM model and parallel mode
MiniBenchmarkRvsCpp(
data = testData,
listOptions = list(PCMBase.Lmr.mode = 21, PCMBase.Threshold.EV = 1e-9, 
PCMBase.Threshold.SV = 1e-9))
# single-trait data, original MGPM model and single mode and enabled option 
# PCMBase.Use1DClasses
MiniBenchmarkRvsCpp(
data = PCMBaseCpp::benchmarkData[1, list(
 tree, 
 X = lapply(X, function(x) x[1,, drop=FALSE]), 
 model = lapply(model, function(m) PCMExtractDimensions(m, dims = 1)))],
listOptions = list(
  PCMBase.Lmr.mode = 11, 
  PCMBase.Threshold.EV = 1e-9, 
  PCMBase.Threshold.SV = 1e-9,
  PCMBase.Use1DClasses = FALSE))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.