Spectral Coherence in Julia

You are essentially trying to perform clustering of the signals, group similar signals together. Since you have a relatively small number of signals, you can use a wide range of tools, including computing all pairwise distances between signals etc.

Without having much insight into the actual properties of the signals, it’s hard to judge whether or not DTW is a suitable metric in this case, but you could attempt to compute the DTW cost matrix using something like (naive)

d = DTW(radius=radius, dist=SqEuclidean())
D = [d(a,b) for a in signals, b in signals]

For a slightly more efficient version, see SpectralDistances.distmat (may not be needed in your case).

If you want to further process the distance matrix D into a clustering, you could pass it into any of the methods from Clustering.jl that accept a distance matrix, such as

using Clustering
cr = hclust(Symmetric(sqrt.(D)))
assignments = cutree(cr,k=3) # k is desired number of clusters

You could also try the built-in clustering dbaclust in DynamicAxisWarping

I do not think that MatrixProfile is a suitable tool in this case, at least not the standard techniques associated with the matrix profile. You are certainly looking for something more towards computing distances/similarity and clustering.

2 Likes