apollo_speedTest: Measures evaluation time of a model

View source: R/apollo_speedTest.R

apollo_speedTestR Documentation

Measures evaluation time of a model

Description

Measures the evaluation time of a model for different number of cores and draws.

Usage

apollo_speedTest(
  apollo_beta,
  apollo_fixed,
  apollo_probabilities,
  apollo_inputs,
  speedTest_settings = NA
)

Arguments

apollo_beta

Named numeric vector. Names and values for parameters.

apollo_fixed

Character vector. Names (as defined in apollo_beta) of parameters whose value should not change during estimation.

apollo_probabilities

Function. Returns probabilities of the model to be estimated. Must receive three arguments:

  • apollo_beta: Named numeric vector. Names and values of model parameters.

  • apollo_inputs: List containing options of the model. See apollo_validateInputs.

  • functionality: Character. Can be either "components", "conditionals", "estimate" (default), "gradient", "output", "prediction", "preprocess", "raw", "report", "shares_LL", "validate" or "zero_LL".

apollo_inputs

List grouping most common inputs. Created by function apollo_validateInputs.

speedTest_settings

List. Contains settings for this function. User input is required for all settings except those with a default or marked as optional.

  • nCoresTry: Numeric vector. Number of threads to try. Default is from 1 to the detected number of cores.

  • nDrawsTry: Numeric vector. Number of inter and intra-person draws to try. Default value is c(50, 100, 200).

  • nRep: Numeric scalar. Number of times the likelihood is evaluated for each combination of threads and draws. Default is 10.

Details

This function evaluates the function apollo_probabilities several times using different number of threads (a.k.a. processor cores), and draws (if the model uses mixing). It then plots the estimation time for each combination. Estimation time grows at least linearly with number of draws, while time savings decrease with the number of threads. This function can help decide what number of draws and cores to use for estimation, though a high number of draws is always recommended. If the computer will be used for additional activities during estimation, no more than (machine number of cores - 1) should be used. Using more threads than cores available in the machine will lead to reduce dperformance. The use of additional cores come at the expense of additional memory usage. If R uses more memory than the physical RAM available, then significant slow-downs in processing time can be expected. This function can help avoiding such pitfalls.

Value

A matrix with the average time per evaluation for each number of threads and draws combination. A graph is also plotted.


apollo documentation built on Oct. 2, 2024, 1:08 a.m.