[SciPy-Dev] splitting an ordered list as evenly as possilbe

Keith Goodman kwgoodman at gmail.com
Wed Aug 25 10:10:56 EDT 2010


On Wed, Aug 25, 2010 at 7:00 AM, John Hunter <jdh2358 at gmail.com> wrote:
> Suppose I have an ordered list/array of numbers, and I want to split
> them into N chunks, such that the intersection of any chunk with each
> other is empty and the data is split as evenly as possible (eg the std
> dev of the lengths of the chunks is minimized or some other such
> criterion).

How about using the percentiles of np.unique(x)? That takes care of
the first constraint (no overlap) but ignores the second constraint
(min std of cluster size).



More information about the SciPy-Dev mailing list