[SciPy-User] memory error - numpy mean - netcdf4
srean
srean.list@gmail....
Fri Aug 26 19:54:41 CDT 2011
On Fri, Aug 26, 2011 at 2:33 PM, Phil Morefield <philmorefield@yahoo.com>wrote:
>
> The formula you have written looks like you're collapsing everything into a
> single value. I think he's trying to average a bunch of 2D arrays into a
> single 2D array.
>
You are correct, the form that I posted can be read as if it is for
updating single mean vector \mu, but you can use the same for an nd-array
trivially. Just have \mu and t as nd-arrays. m can be one too. Numpy
broadcasting will take care of the rest.
One advantage is that it requires only a constant amount of memory for the
computation, you can even read the data in from an infinite pipe or
generator that yields a single vector or a matrix at a time (or bundles them
up m at a time). It will always be uptodate with the current estimate of the
means. In fact will work for any moment too.
--srean
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.scipy.org/pipermail/scipy-user/attachments/20110826/2babc07a/attachment.html
More information about the SciPy-User
mailing list