dionysus Wasserstein distances

Adam Spannaus
 

Hi Dmitriy,

I have a question about computing the Wasserstein distance using Dionysus 2. If either of the the diagrams have a point of multiplicity greater than one, having a death time as inf, the wasserstein distance returns inf. What I am seeing from my data is persistence diagrams that look like:

d1=d.Diagram([(0,float('inf')),
   ...: (0,1.83587),
   ...: (0,3.29106),
   ...: (0,3.40428),
   ...: (0,2.3634),
   ...: (0,3.36883),
   ...: (0,2.40259),
   ...: (0,float('inf')),
   ...: (0,float('inf')),
   ...: (0,float('inf')),
   ...: (0,3.26498),
   ...: (0,3.80988),
   ...: (0,3.25368),
   ...: (0,0.916199)])


d2=d.Diagram([(0,float('inf')),
   ...: (0,2.1269),
   ...: (0,2.5984),
   ...: (0,2.70797),
   ...: (0,2.27383),
   ...: (0,1.60921),
   ...: (0,2.38453),
   ...: (0,2.16508),
   ...: (0,1.55326),
   ...: (0,2.06283),
   ...: (0,1.83689),
   ...: (0,1.57891),
   ...: (0,2.27507),
   ...: (0,2.94212)])

d.wasserstein_distance(d1, d2, q=2)
inf

d3=d.Diagram([(0,float('inf')),
   ...: (0,1.83587),
   ...: (0,3.29106),
   ...: (0,3.40428),
   ...: (0,2.3634),
   ...: (0,3.36883),
   ...: (0,2.40259),
   ...: (0,3.26498),
   ...: (0,3.80988),
   ...: (0,3.25368),
   ...: (0,0.916199)])

d.wasserstein_distance(d2, d3, q=2)
2.6976122856140137

In this example d3 is just d1 with the multiple (0, ‘inf’) pairs removed. Is there an easy way to remove these multiplicities, or should I be looking at something else?

Thank you for your time,
Adam


Join dionysus@groups.io to automatically receive all group messages.