Ejemplo n.º 1
0
    def test_simple(self):
        # Over these 7 points, there are 2 with edges within the same sample.
        # [1,2]-[2,2] & [3,2]-[4,2]
        # |
        # |   x
        # | o o x x
        # | x  o
        # |_ _ _ _ _ _ _
        x = np.array([[1, 2], [2, 2], [3, 1]])
        y = np.array([[1, 1], [2, 4], [3, 2], [4, 2]])

        dm = xca.friedman_rafsky(x, y)
        assert_almost_equal(dm, 2.0 / 7, 3)
Ejemplo n.º 2
0
 def test_compare_with_matlab(self):
     x, y = matlab_sample()
     dm = xca.friedman_rafsky(x, y)
     assert_almost_equal(dm, 0.96667, 4)