Exemplo n.º 1
0
    def test_simple(self):
        d = 2
        n, m = 25, 30

        x = randn(0, 1, (n, d))
        y = randn([1, 2], 1, (m, d))
        dm = xca.seuclidean(x, y)
        assert_almost_equal(dm, np.hypot(1, 2), 2)

        # Variance of the candidate sample does not affect answer.
        x = randn(0, 1, (n, d))
        y = randn([1, 2], 2, (m, d))
        dm = xca.seuclidean(x, y)
        assert_almost_equal(dm, np.hypot(1, 2), 2)
Exemplo n.º 2
0
 def test_compare_with_matlab(self):
     x, y = matlab_sample()
     dm = xca.seuclidean(x, y)
     assert_almost_equal(dm, 2.8463, 4)