The R package lazybar provides progress bar showing estimated remaining time. Multiple forecast methods and user defined forecast method for the remaining time are supported.
You can install the development version from Github with:
# install.packages("devtools")
::install_github("FinYang/lazybar") devtools
<- lazyProgressBar(4)
pb $tick()
pb$tick()
pb$tick()
pb$tick()
pb
# With linearly increasing run time
<- lazyProgressBar(4, method = "drift")
pb for(i in 1:4){
Sys.sleep(i * 0.2)
$tick()$print()
pb
}
# With user defined forecast function
# The forecast function itself will
# require certain computational power
<- function(dtime, i, n, s = 10){
forecast_fn # When the number of ticks is smaller than s
# Estimate the future run time
# as the average of the past
if(i<s){
<- mean(dtime)*(n-i)
eta
}
# When the number of ticks is larger than s
# Fit an arima model every s ticks
# using forecast package
if(i>=s){
if(i %% s ==0){
<- forecast::auto.arima(dtime)
model
}<- forecast::forecast(model, h=n-i)$mean
runtime if(i %% s !=0){
<- runtime[-seq_len(i %% s)]
runtime
}<- sum(runtime)
eta
}return(eta)
}
<- lazyProgressBar(10, fn = forecast_fn, s=3)
pb for(i in 1:10){
Sys.sleep(i * 0.2)
$tick()$print()
pb }
This package is free and open source software, licensed under GPL-3.