# Sequential subsequence removal with arbitrary predicate

I want to extract sub-sequences from a sequence of float values. The "scale" and range of these values is arbitrary (as I can manipulate it at will) but the "shape" is consistent.

For a visual example:

I want to extract the above five stacks as five "chunks". I want them in the order they occur (left-to-right). Do not be too distracted with the visual, though, as there can be an arbitrary number of points within the interval, but guaranteed $$N_{points} < 2000$$.

I have tried framing this problem as a dynamic partitioning problem, as an iterative subsequence extract problem, and something like $$argmax$$ but applied multiple times on a shrinking sequence.

Please pardon the ambiguity; I am struggling to even articulate the problem in a useful fashion. Critique and guidance would be much appreciated

• In your example, do you want to cut your plot into 5 partitions? Why cutting by some small value doesn't work for you? – Evil Jul 12 '19 at 16:31
• @Evil Well that's just it: if it's just cutting by a small value, I don't think I know how to do that - elegantly, or not. What does that algorithm look like? – stephenjfox Jul 12 '19 at 17:41