给定两个包含M个实数的序列/向量,我可以使用多种度量标准轻松计算它们的相似度或相关性。但是,在一组序列中查找最接近的M序列或更长序列的最接近子序列是否有高效的结构?滑动窗口可能是朴素/暴力的方法。不过,有没有更好的方法呢?
编辑:当我打字时,我在想像在K-d树中搜索可能有效,其中每个偏移量是M维空间中的一个单独维度?
编辑:当我打字时,我在想像在K-d树中搜索可能有效,其中每个偏移量是M维空间中的一个单独维度?
# If you forget to take the complex conjugate of V you'll be doing a
# convolution instead of a correlation
V' := Fft(Conjugate(V))
for each vector W in C:
W' := Fft(W)
P := W' * V' # Multiplication here is the dot product
R := inverse_Fft(P)
# Check through the vector R for any spikes, a large value at
# R[i] indicates that if you shift W' by i then it will
# correlate strongly with W