From 9ee87cb679b1edc3e8d1674a06e823288d2fc910 Mon Sep 17 00:00:00 2001 From: kernelmethod <17100608+kernelmethod@users.noreply.github.com> Date: Sun, 9 Feb 2020 01:11:36 -0700 Subject: [PATCH] Tentatively remove Wasserstein distance from the module. --- src/LSHFunctions.jl | 3 +-- src/similarities.jl | 36 ------------------------------------ 2 files changed, 1 insertion(+), 38 deletions(-) diff --git a/src/LSHFunctions.jl b/src/LSHFunctions.jl index 843f947..2ff4244 100644 --- a/src/LSHFunctions.jl +++ b/src/LSHFunctions.jl @@ -38,8 +38,7 @@ Exports # Similarity functions, norms, inner products export cossim, inner_prod, ℓ1, ℓ2, ℓp, L1, L2, Lp, ℓ1_norm, ℓ2_norm, - ℓp_norm, L1_norm, L2_norm, Lp_norm, jaccard, wasserstein_1d, - wasserstein1_1d, wasserstein2_1d + ℓp_norm, L1_norm, L2_norm, Lp_norm, jaccard # Hash functions export SimHash, L1Hash, L2Hash, MIPSHash, SignALSH, MinHash, diff --git a/src/similarities.jl b/src/similarities.jl index 1ebf8bb..0e91a1f 100644 --- a/src/similarities.jl +++ b/src/similarities.jl @@ -375,39 +375,3 @@ L1_norm(f, interval::LSHFunctions.RealInterval) = quadgk(x -> abs(f(x)), interva @doc (@doc Lp_norm) L2_norm(f, interval::LSHFunctions.RealInterval) = √quadgk(x -> abs2(f(x)), interval.lower, interval.upper)[1] - -#==================== -1D Wasserstein distance -====================# - -@doc raw""" - wasserstein_1d(f, g, p) - wasserstein1_1d(f, g) - wasserstein2_1d(f, g) - emd(f, g) - -Compute the order-``p`` Wasserstein distance between two probability distributions defined on the interval ``[-1,1]``. -- `wasserstein1_1d(f,g) == emd(f,g) == wasserstein_1d(f, g, 1)` -- `wasserstein2_1d(f,g) == wasserstein_1d(f, g, 2)` - -# Arguments -- `f` and `g`: two probability distributions defined on ``[-1,1]``. -- `p::Real`: the order of Wasserstein distance to compute. -""" -function wasserstein_1d(f, g, p::Real) - # For one-dimensional probability distributions, the Wasserstein distance has - # the closed form - # - # ∫_0^1 |F^{-1}(x) - G^{-1}(x)|^p dx - # - # where F^{-1} and G^{-1} are the inverse c.d.f.s of f and g. We use this - # formula to compute the distance between f and g. - error("TODO") -end - -@doc (@doc wasserstein_1d) -wasserstein1_1d(f, g) = wasserstein_1d(f, g, 1) -emd = wasserstein1_1d - -@doc (@doc wasserstein_1d) -wasserstein2_1d(f, g) = wasserstein_1d(f, g, 2)