You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
NumPy's current implementation has two main advantages:
It is noticeably faster (Welford's has to do a division in the inner loop), and not much worse, if at all, when it comes to numerical stability.
It can be coded in pure Python, while Welford's would require Cython or C.
Some time ago I rewrote Pandas' sliding variance to use Welford's, see pandas-dev/pandas#6817, and I looked really hard into putting it also in NumPy, and didn't manage to find a good way of fitting it in. How do you see this being implemented, Alex?
I don't know enough about numpy's internals to decide this. If implementing this is impractical due to numpy's architectural constraints then I guess this issue should be closed.
This would be a great addition to numpy; not as a replacement for np.mean and np.var, but as a standalone feature. Online calculations happen all the time (due to resource limitations), and a np.welford function would be convenient so that not everyone has to implement welford on its own over and over again.
Welford's algorithm computes the mean and variance in a way that pays attention to stability while using less memory overhead than the current numpy implementation of variance or standard deviation. See http://stackoverflow.com/questions/32135572, #1696, #3685.
The text was updated successfully, but these errors were encountered: