1
$\begingroup$

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: points with noise removed

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

$\endgroup$
2
  • $\begingroup$ In your example, do you want to cut your plot into 5 partitions? Why cutting by some small value doesn't work for you? $\endgroup$
    – Evil
    Commented Jul 12, 2019 at 16:31
  • $\begingroup$ @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? $\endgroup$ Commented Jul 12, 2019 at 17:41

2 Answers 2

1
$\begingroup$

Set threshold to, say 30 (arbitrary value greater than noise in the plot) and start from left to right, if value is greater than threshold, keep it as run - collect data to temporary array, if values drop below threshold then discard data and create new array for another run.

This will cut 5 bars and discard data between, if you want to keep data, you have to decide the shape (divide evenly between bars, keep it to left or to right).
It may happen that data drops below threshold in the bar (not visible in plot), then keep counter of dropped values, if it is small, add them to last run.

$\endgroup$
1
$\begingroup$

Use changepoint detection. This will identify the boundaries between the clusters.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.