I want to calculate the running average over an infinite (or a huge) number of iterations:
import random
epochs = 1e10
for epoch in range(epochs):
new_value = random.randint(1, 100)
new_running_average = get_avg(previous_average, new_value) # what is this function going to be?
The naive approach would be to add any new value new_value
to a list, and then average the list at each iteration. But, this is not realistic as 1) the number of iterations is far too large, and 2) I have to create many of such averages for many parameters.
The existing SO questions I found around calculating running average (e.g., this or this) use a fix data list that is relatively small, so it's rather trivial.