createTimer: Create a timer object. Get the data frame of a timer object

Description Usage Arguments Value Examples

View source: R/timer_function.R

Description

This is a modified version of the timeR package for an internal use. Full credit is to Yifu Yan, the author of the timeR package.

createTimer creates a timer object.

getTimer returns a data frame with all records saved by the timer object. Columns in the data.frame are: event, start, end, duration, RMSE, MAE, stars, params, comment.

Usage

1
2
3
createTimer(verbose = TRUE)

getTimer(object)

Arguments

verbose

A parameter to control whether to print messages while using methods. Default to TRUE.

object

The name for timer object.

Value

An (invisible) object of R6 class for createTimer. A data.frame for getTimer.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
## Create a timer object. Record events. Get all records.
timeTT <- createTimer(FALSE) # print is disabled
timeTT <- createTimer()      # print is enabled
timeTT$start("event1")
Sys.sleep(1)
timeTT$stop("event1", RMSE = 1, MAE = 1.3, stars = "*", 
            params = "maxiter=100, lr=0.01", comment = "OK for 1",  
            printmsg = TRUE)
timeTT$start("event2")
Sys.sleep(2)
timeTT$stop("event2", RMSE = 2, MAE = 2.6, stars = "**",  
            params = "maxiter=1000, lr=0.001", comment = "OK for 2",  
            printmsg = FALSE)
getTimer(timeTT)

pkR-pkR/NNbenchmark2019 documentation built on June 22, 2020, 12:10 a.m.