stopwatch: stopwatch

Description Usage Arguments Value Examples

View source: R/stopwatch.R

Description

measures computer time for learning and testing. There is a difficulty with the lazy evaluation mechanism in R: since the learning funciton returns a function that acts as a closure and keeps a reference to its calling environment, and the model is not learnt before actually evaluating the function, we have to measure the times A and B indirectly. Therefore, this function approximates the learning time by measuring the time for learning and testing k times, in such a way that the evaluation promise has to be fulfilled, minus the time for drawing, for various values of k, and then fitting the linear model that the total time is A + kB.

Usage

1
stopwatch(learningAlgorithm, drawFunction, g, testChunkSize, ...)

Arguments

learningAlgorithm

a function that takes learning data as argument and outputs a prediction rule in the form of another function that maps test data to numeric vectors. These can be errors or AUCs, one for each testing data set.

drawFunction

a function that returns a dataframe with the response variable in a column names y

g

the learning sample sizelearningAlgorithm, drawFunction, Nwithin=12, Nbetween=17)

testChunkSize

the sample size of a single test chunk

...

additional parameters to be passed to the drawing function

Value

a list with the times A and B in nanoseconds

Examples

1
2
3
4
5
6
stopwatch(
learningAlgorithm=svmLearning,
drawFunction=drawLogit,
g=20,
testChunkSize=1
)

Mathias-Fuchs/simTestSize documentation built on May 7, 2019, 3:42 p.m.