@@ -31,12 +31,6 @@ def test_euclidean(self):
3131 expected = np .array ([0 , 0 , 0 , 8 , 0 , 0 , 16 , 8 , 0 ])
3232 np .testing .assert_array_almost_equal (euclidean_result , expected , decimal = 1 )
3333
34- def test_squared_euclidean (self ):
35- squared_euclidean_result = squared_euclidean (
36- Array (data = [[0 , 1 , 2 , 3 ], [4 , 5 , 6 , 7 ], [8 , 9 , 10 , 11 ]])).to_numpy ().flatten ()
37- expected = np .array ([0 , 0 , 0 , 64 , 0 , 0 , 256 , 64 , 0 ])
38- np .testing .assert_array_almost_equal (squared_euclidean_result , expected , decimal = 1 )
39-
4034 def test_dtw (self ):
4135 euclidean_result = dtw (Array (
4236 data = [[1 , 1 , 1 , 1 , 1 ], [2 , 2 , 2 , 2 , 2 ], [3 , 3 , 3 , 3 , 3 ], [4 , 4 , 4 , 4 , 4 ], [5 , 5 , 5 , 5 , 5 ]])).to_numpy ()
@@ -55,6 +49,18 @@ def test_manhattan(self):
5549 expected = np .array ([[0 , 0 , 0 , 0 , 0 ], [5 , 0 , 0 , 0 , 0 ], [10 , 5 , 0 , 0 , 0 ], [15 , 10 , 5 , 0 , 0 ], [20 , 15 , 10 , 5 , 0 ]])
5650 np .testing .assert_array_almost_equal (result , expected , decimal = 2 )
5751
52+ def test_sbd (self ):
53+ sbd_result = sbd (
54+ Array (data = [[1 , 2 , 3 , 4 , 5 ], [1 , 1 , 0 , 1 , 1 ], [10 , 12 , 0 , 0 , 1 ]])).to_numpy ().flatten ()
55+ expected = np .array ([0 , 0 , 0 , 0.505025 , 0 , 0 , 0.458583 , 0.564093 , 0 ])
56+ np .testing .assert_array_almost_equal (sbd_result , expected , decimal = 1 )
57+
58+ def test_squared_euclidean (self ):
59+ squared_euclidean_result = squared_euclidean (
60+ Array (data = [[0 , 1 , 2 , 3 ], [4 , 5 , 6 , 7 ], [8 , 9 , 10 , 11 ]])).to_numpy ().flatten ()
61+ expected = np .array ([0 , 0 , 0 , 64 , 0 , 0 , 256 , 64 , 0 ])
62+ np .testing .assert_array_almost_equal (squared_euclidean_result , expected , decimal = 1 )
63+
5864
5965if __name__ == '__main__' :
6066 suite = unittest .TestLoader ().loadTestsFromTestCase (DistancesTest )
0 commit comments