JuliaOptimalTransport / OptimalTransport.jl

Optimal transport algorithms for Julia
https://juliaoptimaltransport.github.io/OptimalTransport.jl/dev
MIT License
93 stars 8 forks source link

wasserstein calculate #183

Open Li-shiyue opened 9 months ago

Li-shiyue commented 9 months ago

Hello,how can I calculate wasserstein distance if I only get two histogram. I notice DiscreteNonParametric however it needs true probability vector whicih needs sum to 1 how can I calculate the distance instead the constraint?

zsteve commented 9 months ago

Hi @Li-shiyue,

however it needs true probability vector whicih needs sum to 1

The Wasserstein distance requires that both inputs have the same sum. In the setting of DiscreteNonParametric, they sum to 1. If you have count data, transforming from counts to frequencies would give you probability vectors that sum to 1. Could you provide some example code or inputs? Would help clarify this

Stephen