3 ms·
Your sum variable could get pretty large, consider using the streaming mean function, something like: new_mean = ((n*old_mean)+temp)/(n+1)
by jackhalford 3y ago
Your sum variable could get pretty large, consider using the streaming mean function, something like:
new_mean = ((n*old_mean)+temp)/(n+1)
- apwheele 3y agoHad this same thought as well. Definitely comes up when calculating variance this way in streaming data. https://stats.stackexchange.com/a/235151/1036 https://stats.stackexchange.com/a/235151/1036 I am not sure if `n*old_mean` is a good idea. Wellford's is typically something like inside the loop count += 1; delta = current - mean; mean += delta/count;