[Numpy-discussion] what is the best way to do a statistical mode operation?

Gordon Wrigley gordon at tolomea.com
Sun Oct 3 08:41:12 EDT 2010


I have an array of uint8's that has a shape of X*Y*Z*8, I would like to
calculate modes along the 8 axis so that I end up with an array that has the
shape X*Y*Z and is full of modes.
I'm having problems finding a good way of doing this. My attempts at solving
this using bincount or histogram produce an intermediate array that is 32x
the size of my input data and somewhat larger than I have the memory to deal
with.
Can anyone suggest a good way to produce modes over sets of 8 bytes?

Also in the instance where there are multiple modes for a particular set I'm
happy for it to pick any one arbitrarily.

G
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/numpy-discussion/attachments/20101003/9b57f42b/attachment.html>


More information about the NumPy-Discussion mailing list