make_container_for_function_calls: container for function calls, can be used as a progress bar

Description Usage Details Value See Also Examples

View source: R/f_train.R

Description

creates a closure with a make_call() method that wraps any function call. When the wrapper is used the function call is saved and the calls are counted and the progress is being printed. Use the method set_total() to input the total number of function calls. Based on the total an ETA is estimated and a percentage calculated.

Usage

1

Details

DETAILS

Value

container

See Also

now,time_length

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
.f = randomForest::randomForest
call_cont = make_container_for_function_calls()
call_cont$set_total(4)
m_wr = call_cont$make_call( .f = .f, formula = disp~., data = mtcars )

#pipe version
call_cont = make_container_for_function_calls()
call_cont$set_total(5)

pl = pipelearner::pipelearner(mtcars) %>%
  pipelearner::learn_models( models = c( call_cont$make_call )
                             , formulas = c(disp~.)
                             , .f = c( randomForest::randomForest )
                             , function_name = 'randomForest'
                             , print_call = c(T)
                           ) %>%
  pipelearner::learn_cvpairs( pipelearner::crossv_kfold, k = 5 ) %>%
  pipelearner::learn()

erblast/oetteR documentation built on Aug. 4, 2018, 11:03 p.m.