I am collecting sensor data from a repetitive physical process (think an elevator moving up and down). This is an example of what the signal looks like. The y-axis reflects our equivalent of 'height' and the x-axis is just time. Perhaps not surprising, this particular image reflects 5 repetitions of the process in question.

Although this particular example is quite regular, it is not always so, sometimes with small gaps in the data, jumps, or increased noise. Is there a standard machine learning or statistical approach to counting the number of repetitions for a given signal/data series? So far, our hand-written methods seem to top out at around 80% accuracy. We've also tried an LSTM approach, also with limited success.
Have a look at the scipy function find_peaks. With it you can specify some threshold for the peaks to be detected, and spacing between them. Should work quite nicely for what yyou are looking for.
That of course, if the actual repeated signal you are hoping to detect is always present as a peak. If you are simply trying to detect potentially any pattern that repeats itself in the signal perhaps you could take the convolution and look for the peaks of that instead.
You could try first using autocorrelation to find matching repetitions within the signal; and then feed the autocorrelation results to a ML algorithm for thresholding any found correlation peaks above the noise.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With