示例#1
0
    def test_euclidean(self):

        v1 = [4.5, 3]
        v2 = [4.0, 2]
        expected_value = 0.47213595499957939
        self.assertEqual(expected_value, similarity_calculator.euclidean(v1, v2))

        v1 = [5, 1, 2]
        v2 = [5, 1, 2]
        self.assertEqual(1, similarity_calculator.euclidean(v1, v2))
示例#2
0
    def test_euclidean(self):

        v1 = [4.5, 3]
        v2 = [4.0, 2]
        expected_value = 0.47213595499957939
        self.assertEqual(expected_value,
                         similarity_calculator.euclidean(v1, v2))

        v1 = [5, 1, 2]
        v2 = [5, 1, 2]
        self.assertEqual(1, similarity_calculator.euclidean(v1, v2))
示例#3
0
    def test_chebyshev(self):

        v1 = [4.5, 4]
        v2 = [4.0, 2]
        expected_value = 1./3
        self.assertEqual(expected_value, similarity_calculator.chebyshev(v1, v2))

        v1 = [5, 1, 2]
        v2 = [5, 1, 2]
        self.assertEqual(1, similarity_calculator.euclidean(v1, v2))
示例#4
0
    def test_chebyshev(self):

        v1 = [4.5, 4]
        v2 = [4.0, 2]
        expected_value = 1. / 3
        self.assertEqual(expected_value,
                         similarity_calculator.chebyshev(v1, v2))

        v1 = [5, 1, 2]
        v2 = [5, 1, 2]
        self.assertEqual(1, similarity_calculator.euclidean(v1, v2))