コード例 #1
0
ファイル: test_similarity.py プロジェクト: antoine-tran/yelp
    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
ファイル: test_similarity.py プロジェクト: antoine-tran/yelp
    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))