0

I have a time series which shows activity and rest segments. The picture below shows the first three segments (activity, rest, activity). Activity segments always show some form of periodic oscillation, while rest segments do not show any pattern at all. However, I plotted the vertical lines in order to make the segments more visible.

enter image description here The activity segments, as well as the rest segments have different lengths, of course, so segmenting based on length does not work.

What I tried/thought of:

  1. There is an amazing library called matrixprofile which is pretty powerful for such tasks. I played around with it but it has some package requirements that messed up other packages that I am using: It requires protobuf>=3.11.2,<4.0.0, which caused my tensorflow to not work anymore. Took my hours to get it to work again, so I cannot use matrixprofile.

  2. Convolutional Neural Networks worked well for me for other anomaly detection tasks. But in this case I do not know how to use them. It would maybe be some form of regression, predicting the length of an anomaly (=activity segment). But I am not sure if this makes sense here.

Do you know a python-based approach that could segment the time series as done in the picture (e.g. by automatically finding the borders of the segments and returning the x-values of the borders)?

Any recommendations are welcome. The less assumptions/hyperparameters they require, the better.

lonyen11
  • 91
  • 11
  • Visually it's clear why you'd pick those segments, but what exactly is your criterium here? One way would be to compute something like the running average of the difference between consecutive points and then cut your segment where that average crosses some threshold value. – Grismar Jun 28 '22 at 13:56
  • I just added the criterion in bold in my post. Thank you for reminding me of mentioning it. – lonyen11 Jun 28 '22 at 14:03
  • @lonyen11 You might be able to avoid the Python packaging problem by trying out the [STUMPY](https://stumpy.readthedocs.io/en/latest/index.html) package, which also provides matrix profile capabilities. The semantic segmentation tutorial might be helpful in this case: https://stumpy.readthedocs.io/en/latest/Tutorial_Semantic_Segmentation.html – slaw Sep 28 '22 at 13:42

0 Answers0