# Path: flyingpigeon/dissimilarity.py
# def reshape_sample(x, y):
# def standardize(x, y):
# def seuclidean(x, y):
# def nearest_neighbor(x, y):
# def zech_aslan(x, y):
# def skezely_rizzo(x, y):
# def friedman_rafsky(x, y):
# def kolmogorov_smirnov(x, y):
#     def pivot(x, y):
# def kldiv(x, y, k=1):


import pytest
import numpy as np
from flyingpigeon import dissimilarity as dd
from numpy.testing import assert_almost_equal as aaeq
from scipy import stats
from scipy import integrate
        from numpy.random import normal, multivariate_normal
        x = np.random.randn(n, d)
        # y = np.random.randn(m, d)

        # Almost identical samples
        dm = dd.zech_aslan(x + .001, x)
        assert dm < 0

    def test_compare_with_matlab(self):
        x, y = matlab_sample()
        dm = dd.zech_aslan(x, y)
        aaeq(dm, 0.77802, 4)


class TestFR():
    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 = dd.friedman_rafsky(x, y)
        aaeq(dm, 2. / 7, 3)

    def test_compare_with_matlab(self):
        x, y = matlab_sample()

# Path: flyingpigeon/dissimilarity.py
# def reshape_sample(x, y):
# def standardize(x, y):
# def seuclidean(x, y):
# def nearest_neighbor(x, y):
# def zech_aslan(x, y):
# def skezely_rizzo(x, y):
# def friedman_rafsky(x, y):
# def kolmogorov_smirnov(x, y):
#     def pivot(x, y):
# def kldiv(x, y, k=1):


# Path: tests/test_dissimilarity.py
import pytest
import numpy as np
from flyingpigeon import dissimilarity as dd
from numpy.testing import assert_almost_equal as aaeq
from scipy import stats
from scipy import integrate
        from numpy.random import normal, multivariate_normal

        x = np.random.randn(n, d)
        # y = np.random.randn(m, d)

        # Almost identical samples
        dm = dd.zech_aslan(x + .001, x)
        assert dm < 0

    def test_compare_with_matlab(self):
        x, y = matlab_sample()
        dm = dd.zech_aslan(x, y)
        aaeq(dm, 0.77802, 4)


class TestFR():
    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 = dd.friedman_rafsky(x, y)
        aaeq(dm, 2. / 7, 3)

    def test_compare_with_matlab(self):
        x, y = matlab_sample()

        dm = dd.friedman_rafsky(x, y)