Python模块 动态时间扭曲被用作时间序列之间的相似度。 该软件包提供了两种实现: 该算法的基本版本(请参见) 依赖scipy cdist的加速版本(有关详细信息,请参见 ) import numpy as np # We define two sequences x, y as numpy array # where y is actually a sub-sequence from x x = np . array ([ 2 , 0 , 1 , 1 , 2 , 4 , 2 , 1 , 2 , 0 ]). reshape ( - 1 , 1 ) y = np . array ([ 1 , 1 , 2 , 4 , 2 , 1 , 2 , 0 ]). reshape ( - 1 , 1 ) from dtw import dtw manhattan_distance = lambd
2021-10-02 20:37:47 62KB python dtw distance distance-measures
1