Loading Bar in Python
The simplest loading bar:
import time
import numpy as np
losses = []
EPOCH = 1000
for t in range(EPOCH):
print("---> " + str(100 * t/EPOCH) + "%", end = '\r')
time.sleep(0.002)A more sophisticated one:
import time
import numpy as np
EPOCH = 1000
print("|-----------------------------------------------------------------------------|")
print(" ", end='', flush=True)
for t in range(EPOCH):
# Print Progress
if t in np.floor(np.linspace(start=0, stop=EPOCH, num=78)):
print("#", end='', flush=True)
time.sleep(0.02)R
Similarly in R and Julia
EPOCH <- 100
for (i in seq_len(EPOCH)) {
cat(i/EPOCH, endsWith="\r")
Sys.sleep(0.1)
}EPOCH = 1000
for t = 1:EPOCH
print(100 * t/EPOCH)
print("\r")
sleep(0.002)
end