# Pattern recognition in time series 4x3000 vector

I have a vector, here is a sample of some data from some heat flow data: I would like to identify features in this image. In the example above I have identified one feature I would like to automatically recognize. There are others I would like to identify. In this example, the data in all four vectors moves up at the same time, however this can happen at different rates and sometimes it can be delayed.

My regular set of tools is inadequate for this type of problem. I have no problem detecting peaks or using thesholding. This is the first time I've had to do this with multi dimensional data. The other problem is the data is very noisy so peak detection and thresholding yeilds false positives.

I would like to plug this into a neural network and classify it, but the problem is in this 4x3000 vector I might only have 4 or 5 examples of features that I could train with. So it might be hard to train a CNN if I don't have many examples.

There are many tools that work with 1x(n col) vectors, but I need to detect patterns that coincide in all four vectors. Another problem I have is

How can I compare a 4x5 section of the 4x3000 matrix and find similarities?

The think I would really like to do is take a 4x5 matrix and compare it with the rest of the vector and see if and where it matches (so really there would be 2995 matrices of size 4x5). Are there neural networks that can make multidimensional comparisons like this?

• You are mainly referring to supervised learning, (labeling the data and training the algorithm to learn to distinguish this categories). There is also unsupervised learning which you could apply. This family of algorithms tries to cluster the data into different groups. A comment from a naive person to your data: I have no idea which patterns you see in this example ;) ! Oct 13 '17 at 7:25

Assuming your time series are the same length, take your data and produce spectrograms, $S_k$, for each row of the $4 \times 3000$ data matrix $D$ that you have. Since these individual time series should be similar, this means you can try to extract features by stacking these spectrograms next to each other horizontally into a large matrix. So if you have $S_k$ as the spectrogram for row $k$, you can create the overall spectrogram as $S = \left[ S_1, \cdots, S_4\right]$.

From here, find the modulus of the elements (since they will be complex), and define the result as $\bar{S} = |S|$. Then I recommend performing a Non-negative Matrix factorization on $\bar{S}$ such that you get the low-rank approximation $\bar{S} \approx FW$ with some small specified number of features. $F$ in this case will be your features (they will be column vectors in $F$) and $W$ will be your new data in feature-space. You can look at $W$ to see where a given feature from $F$ appears. Given you've generated $F$, all you need to do to do to find $W$ for individual/new time series results is compute the spectrogram for that time series, call it $\hat{S}$, and then do $\hat{W} = F^{+} |\hat{S}|$ where $F^{+}$ is the pseudo inverse of $F$. Now you can look at $\hat{W}$ to get an idea of where certain features are being used and also build models using this lower dimensional representation.

Note that the number of features you use will have to be played with. I would look at the modulus of a sample spectrogram to get a feel for how much the frequencies are changing over time and consider roughly how many dominant features you think could be used to approximate it and then set the number of features as that to start. As an example, I have done this stuff above to identify different sounds in an audio clip and I only had to reduce it to the number of dominant sounds (there were 3 of them) so that hugely minimized my dataset size. Images from this example are shown below:   One thing you might consider as well is taking the separate data streams and trying to fuse them using some sort of filtering algorithm or using Hidden Markov Models. Then just perform the above spectrogram computations on the filtered result.

• I will try this, this might be a good way to generate training data for a neural network. Oct 13 '17 at 18:37
• @laptop2d it should be! Oct 13 '17 at 18:55