I have a dataset which contains minute level sensor measurements. Sample is shown here: enter image description here

To me useful information are these peaks in time series, mostly their peak and duration. My idea is to take out only windows with each peak and then to cluster them to a few typical peaks. Problem is how to determine window size since they have different duration and they start at a different time each day.

I would like to get this, where each colour on the image is an array containing only the values and timestamp of that peak:

enter image description here

I am thinking of SAX, where I would need some methodology to cut the sequence when the value gets to low (normal), e.g. abbbccdcbbbbaaaaabbbbcbbaaaa, would be cut to abbbccdcbbbba and abbbbcbba. But maybe there is other, better way.

Any ideas and comments are welcome. Thank you :)

  • $\begingroup$ If you're in python, scipy.signal.find_peaks is a pretty useful function with a lot of options on how to search and criteria for classifying peaks. I'd even just look at the documentation to get an idea of useful approaches to the problem. $\endgroup$
    – Tom
    May 2 at 4:19

1 Answer 1


There are a few simple approaches you might try. They all exploit different kinds of patterns in your data, and they all have at least one parameter you'll need to tweak.

  • Fixed-duration windows around a peak. As you've said, this doesn't work very well.
  • Set a y-axis threshold. A peak starts when the value goes above this threshold, and ends when it goes below again. Some mild high-pass filtering may help here.
  • Smooth your data (for example using a low-pass filter). Peaks start and end at the troughs, where the slope of the filtered data goes from negative to positive. Results depend on amount of smoothing.
  • $\begingroup$ Thanks, I will check these methods and come back if needed $\endgroup$
    – SirDawar
    Oct 22, 2020 at 10:14
  • $\begingroup$ I didn't get satisfying results with the filtering method, is there some possibility to use machine learning method for this? $\endgroup$
    – SirDawar
    Nov 6, 2020 at 9:14

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.