Пример #1
0
 def test_c5_c6_dtw_path(self):
     r, d = similaritymeasures.dtw(curve5, curve6)
     path = similaritymeasures.dtw_path(d)
     c = cdist(curve5, curve6)
     cost = sum(c[path[:, 0], path[:, 1]])
     self.assertTrue(np.isclose(r, cost))
Пример #2
0
 def test_random_dtw(self):
     r, d = similaritymeasures.dtw(curve_a_rand, curve_b_rand)
     path = similaritymeasures.dtw_path(d)
     c = cdist(curve_a_rand, curve_b_rand)
     cost = np.sum(c[path[:, 0], path[:, 1]])
     self.assertTrue(np.isclose(r, cost))
Пример #3
0
 def test_P_Q_dtw_path(self):
     r, d = similaritymeasures.dtw(P, Q)
     path = similaritymeasures.dtw_path(d)
     c = cdist(P, Q)
     cost = sum(c[path[:, 0], path[:, 1]])
     self.assertTrue(np.isclose(r, cost))