How to use the persim.sliced_wasserstein function in persim

To help you get started, we’ve selected a few persim examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github scikit-tda / persim / test / test_distances.py View on Github external
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)
github scikit-tda / persim / test / test_sliced.py View on Github external
def test_sliced_single():
    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)
github scikit-tda / persim / test / test_sliced.py View on Github external
def test_sliced_some():
    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)
github scikit-tda / persim / test / test_distances.py View on Github external
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)
github scikit-tda / persim / test / test_distances.py View on Github external
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)