def test_single(self): d = sliced_wasserstein( np.array([[0.5, 1]]), np.array([[0.5, 1.1]]) ) # These are very loose bounds assert d == pytest.approx(0.1, 0.01)
def test_different_size(self): d = sliced_wasserstein( np.array([ [0.5, 1], [0.6, 1.1] ]), np.array([ [0.6, 1.2] ]) ) # These are very loose bounds assert d == pytest.approx(0.314, 0.1)
def test_some(self): d = sliced_wasserstein( np.array([ [0.5, 1], [0.6, 1.1] ]), np.array([ [0.5, 1.1], [0.6, 1.2] ]) ) # These are very loose bounds assert d == pytest.approx(0.19, 0.02)
def test_single_point_same(self): dgm = np.array([[0.11371516, 4.45734882]]) dist = sliced_wasserstein(dgm, dgm) assert dist == 0