Re: dionysus Wasserstein distances

Dmitriy Morozov
 

I'm not quite sure what you are after. If you want to reduce multiplicity of all points to one, you could convert a diagram to a set and then construct a new diagram out of it:

s = set([(p.birth,p.death) for p in d1])
d2 = d.Diagram(list(s))

I don't know of a situation where this actually makes sense, but presumably you have something in mind. If you want something more elaborate (like reducing multiplicity of only points at infinity), you'll have to tweak the above idea accordingly. But the point is that you can convert between standard python lists and persistence diagrams in a pretty straightforward way. And you can manipulate those lists in many different ways.

I hope this helps.
Dmitriy  

On Fri, Jun 8, 2018 at 2:34 PM, Adam Spannaus <aspannau@...> wrote:
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.