# How would you use machine learning for peak detection?

I have a noisy signal and I'm trying to find a way to detect peaks with ML. The "peaks" are easy to find as human because they are rhythmic and have the same "general" shape but the amplitude and width of the desired peaks can vary from sample to sample.

Basically I can't just write a simple method to detect the peaks so I wanted to know if I could use ML to train a model that could learn to find the peaks more accurately. I'm new to ML so while I understand what a CNNs, RNNs and LSTM are, I don't know which would be useful in my scenario.

To be honest, I don't think CNNs, RNNs and LSTM are useful for this kind of problem – a bandpass filter followed by a threshold would be.

Now, that would have three parameters:

• Lower cutoff frequency
• Upper cutoff frequency
• threshold value

and what is usually called "Machine Learning" is nothing but finding local minima over some (loss) function with real value over a multidimensional field.
There you go – three dimensions in, find the point in that threedimensional parameter field that when used to parameterize the filter-threshold algorithm yields points closest to these you manually label.

You can very well try and solve that using neural networks! But honestly, if I was to write an optimizer for that problem, it'd probably look at the spectrum of your signal, identify the frequencies of interests through STFT, and then only sweep the remaining threshold parameter to find a good solution.

• But, but, but, "Machine Learning" is such a cool buzzword. – Cedron Dawg Jun 30 at 16:01

Yes, you can apply deep learning to peak detection. A 1D CNN would be appropriate for this task.

Here is an example for such application: Risum, Anne Bech, and Rasmus Bro. "Using deep learning to evaluate peaks in chromatographic data." Talanta 204 (2019): 255-260.

You would need to have annotated data.

If you decide to stick with the classical algorithms, try peak detection with prominence, which is available both in Matlab and in Python.