[Numpy-discussion] A better median function?

Matthew Brett matthew.brett@gmail....
Fri Aug 21 13:33:43 CDT 2009


Hi,

> Nicolas Devillard discusses several algorithms at
> http://ndevilla.free.fr/median/median/index.html

Thanks for this.  A loud 'yes' from the back of the internet too.

I contacted Nicolas Devillard a year or so ago to ask him if we could
include his code in Scipy, and he said 'yes'.  I can forward this if
that's useful.

Nicolas investigated algorithms that find the lower (or upper) median
value.  The lower median is the median iff there are an odd number of
entries in our list, or the lower of the central values in the sort,
when there are an even number of values in the list. So, we need the
upper _and_ lower median when there are an even number of entries.  I
guess the necessity of doing those two related searches may change the
relative strengths of the algorithms, but I'm sure this is a
well-known problem.

Best,

Matthew


More information about the NumPy-Discussion mailing list