论文地址:https://irit.fr/~Julien.Pinquier/Docs/TP_MABS/res/dtw-sakoe-chiba78.pdf
算法思路:
Github地址:https://github.com/pierre-rouanet/dtw
import numpy as np
from dtw import dtw
x = np.array([2, 0, 1, 1, 2, 4, 2, 1, 2, 0])
y = np.array([1, 1, 2, 4, 2, 1, 4, 2])
manhattan_distance = lambda x, y: np.abs(x - y)
d, cost_matrix, acc_cost_matrix, path = dtw(x, y, dist=manhattan_distance)
print(d)
返回值中:
d
:总距离值
cost_matrix
:所有点的距离矩阵
acc_cost_matrix
:累加的距离值
path
:最短路径对应的坐标,为tuple
类型的数据
paper:http://cs.fit.edu/~pkc/papers/tdm04.pdf
算例来自官网:
import numpy as np
from scipy.spatial.distance import euclidean
from fastdtw import fastdtw
x = np.array([[1, 1], [2, 2], [3, 3], [4, 4], [5, 5]])
y = np.array([[2, 2], [3, 3], [4, 4]])
distance, path = fastdtw(x, y, dist=euclidean)
print(distance)
返回值中:
distance
:距离值
path
:最短路径对应的坐标,为list(tuple)
类型的数据
WikiMapia :https://en.wikipedia.org/wiki/Dynamic_time_warping
时间序列相似性度量综述:https://zhuanlan.zhihu.com/p/69170491
HMM学习笔记_1(从一个实例中学习DTW算法):https://www.cnblogs.com/tornadomeet/archive/2012/03/23/2413363.html