#### Bottleneck distance is not symmetric

nukpezah@...

Yes I changed the default value of the dekta argument by progresively increasing delta to 0.0000001, the distance becomes symmetric. Thanks again for the prompt reply.
Sincerely
Jonathna

Dmitriy Morozov

bottleneck_distance computes an approximation. The quality of the approximation is controlled by the delta argument, which by default is .01. Can you pass "delta=.001" to bottleneck_distance and see what happens?

bdist1 = d.bottleneck_distance(dgms1[1], dgms2[1], delta=.001)
bdist2 = d.bottleneck_distance(dgms2[1], dgms1[1], delta=.001)

Symmetry is not guaranteed, but the answers should get closer together (and closer to the correct answer).

On Sun, Nov 18, 2018 at 9:58 AM <nukpezah@...> wrote:

[Edited Message Follows]

Dear Dmitriy,
I am also running into the same issue and am not sure why. I computed pairwise bottleneck distances for 21 different NMR structures of a protein and realized that the distances are not symmetric also which should not be. I am running the code in a Jupyter notebook in Ubuntu. So I decided to test the code on Dmitriy's website for diagram distances and still running into same issues. This is the code below;
import numpy as np
import dionysus as d
f1 = d.fill_rips(np.random.random((20, 2)), 2, 1)
m1 = d.homology_persistence(f1)
dgms1 = d.init_diagrams(m1, f1)
f2 = d.fill_rips(np.random.random((20, 2)), 2, 1)
m2 = d.homology_persistence(f2)
dgms2 = d.init_diagrams(m2, f2)
bdist1 = d.bottleneck_distance(dgms1[1], dgms2[1])
print("Bottleneck distance between 1-dimensional persistence diagrams:", bdist1)
bdist2 = d.bottleneck_distance(dgms2[1], dgms1[1])
print("Bottleneck distance between 1-dimensional persistence diagrams:", bdist2)

```Bottleneck distance between 1-dimensional persistence diagrams: 0.050108347088098526
Bottleneck distance between 1-dimensional persistence diagrams: 0.04992149770259857Thanks for any help!I am running dionysus ver 2.06 in Ubuntu 18.04.1 LTSSincerelyJonathan```

nukpezah@...

Dear Dmitriy,
I am also running into the same issue and am not sure why. I computed pairwise bottleneck distances for 21 different NMR structures of a protein and realized that the distances are not symmetric also which should not be. I am running the code in a Jupyter notebook in Ubuntu. So I decided to test the code on Dmitriy's website for diagram distances and still running into same issues. This is the code below;
import numpy as np
import dionysus as d
f1 = d.fill_rips(np.random.random((20, 2)), 2, 1)
m1 = d.homology_persistence(f1)
dgms1 = d.init_diagrams(m1, f1)
f2 = d.fill_rips(np.random.random((20, 2)), 2, 1)
m2 = d.homology_persistence(f2)
dgms2 = d.init_diagrams(m2, f2)
bdist1 = d.bottleneck_distance(dgms1[1], dgms2[1])
print("Bottleneck distance between 1-dimensional persistence diagrams:", bdist1)
bdist2 = d.bottleneck_distance(dgms2[1], dgms1[1])
print("Bottleneck distance between 1-dimensional persistence diagrams:", bdist2)

```Bottleneck distance between 1-dimensional persistence diagrams: 0.050108347088098526
Bottleneck distance between 1-dimensional persistence diagrams: 0.04992149770259857Thanks for any help!I am running dionysus ver 2.06 in Ubuntu 18.04.1 LTSSincerelyJonathan```

cai.507@...

The unsymmetric example I found is run on Ubuntu with d.__version__ 2.0.6.dev0 in python2.
I tried the same code on mac with d.__version__ 2.0.5 in python2 and got the same result with Dmitriy.

Best,
Chen

Mahdi Kooshkbaghi

I have tested this and I can not reproduce the results as well.
Got the same results as Dimitry.
d.__version__ : 2.0.4
python version: 3.6
Best,
Mahdi

From: dionysus@groups.io [dionysus@groups.io] on behalf of Dmitriy Morozov [dmitriy@...]
Sent: Wednesday, June 20, 2018 12:00 PM
To: dionysus@groups.io
Subject: Re: [dionysus] Bottleneck distance is not symmetric

I'm unfortunately unable to reproduce this. When I run this example, I get:

In Python 2:
>>> import dionysus as d
>>> dgm1 = d.Diagram([(8.04545,4.59091), (5.5,4.68182)])
>>> dgm2 = d.Diagram([(5.96,3.48), (5.24,4.04), (5.24,4.04), (4.44,3.48)])
>>> print d.bottleneck_distance(dgm1, dgm2)
1.73230612278
>>> print d.bottleneck_distance(dgm2, dgm1)
1.73230612278

In Python 3:
>>> import dionysus as d
>>> dgm1 = d.Diagram([(8.04545,4.59091), (5.5,4.68182)])
>>> dgm2 = d.Diagram([(5.96,3.48), (5.24,4.04), (5.24,4.04), (4.44,3.48)])
>>> print(d.bottleneck_distance(dgm1, dgm2))
1.7323061227798462
>>> print(d.bottleneck_distance(dgm2, dgm1))
1.7323061227798462

What does d.__version__ report? I.e., what version of Dionysus are you running?

The only other issue I can think of is that bottleneck_distance computes an approximation, its quality controlled by an extra parameter delta (by default 0.01), so in principle it's possible to get asymmetric answers, but I'm not sure if this is what's going on.

Dmitriy

On Wed, Jun 20, 2018 at 9:19 AM, wrote:
Hi Dimitry,

I found that the bottleneck distance is not symmetric, although the difference is not significant.

import dionysus as d
dgm1 = d.Diagram([(8.04545,4.59091), (5.5,4.68182)])
dgm2 = d.Diagram([(5.96,3.48), (5.24,4.04), (5.24,4.04), (4.44,3.48)])
print d.bottleneck_distance(dgm1, dgm2)
print d.bottleneck_distance(dgm2, dgm1)
1.74330592155
1.73230612278

Best wishes,
Chen

Dmitriy Morozov

I'm unfortunately unable to reproduce this. When I run this example, I get:

In Python 2:
>>> import dionysus as d
>>> dgm1 = d.Diagram([(8.04545,4.59091), (5.5,4.68182)])
>>> dgm2 = d.Diagram([(5.96,3.48), (5.24,4.04), (5.24,4.04), (4.44,3.48)])
>>> print d.bottleneck_distance(dgm1, dgm2)
1.73230612278
>>> print d.bottleneck_distance(dgm2, dgm1)
1.73230612278

In Python 3:
>>> import dionysus as d
>>> dgm1 = d.Diagram([(8.04545,4.59091), (5.5,4.68182)])
>>> dgm2 = d.Diagram([(5.96,3.48), (5.24,4.04), (5.24,4.04), (4.44,3.48)])
>>> print(d.bottleneck_distance(dgm1, dgm2))
1.7323061227798462
>>> print(d.bottleneck_distance(dgm2, dgm1))
1.7323061227798462

What does d.__version__ report? I.e., what version of Dionysus are you running?

The only other issue I can think of is that bottleneck_distance computes an approximation, its quality controlled by an extra parameter delta (by default 0.01), so in principle it's possible to get asymmetric answers, but I'm not sure if this is what's going on.

Dmitriy

On Wed, Jun 20, 2018 at 9:19 AM, wrote:
Hi Dimitry,

I found that the bottleneck distance is not symmetric, although the difference is not significant.

import dionysus as d
dgm1 = d.Diagram([(8.04545,4.59091), (5.5,4.68182)])
dgm2 = d.Diagram([(5.96,3.48), (5.24,4.04), (5.24,4.04), (4.44,3.48)])
print d.bottleneck_distance(dgm1, dgm2)
print d.bottleneck_distance(dgm2, dgm1)
1.74330592155
1.73230612278

Best wishes,
Chen

cai.507@...

Hi Dimitry,

I found that the bottleneck distance is not symmetric, although the difference is not significant.

import dionysus as d
dgm1 = d.Diagram([(8.04545,4.59091), (5.5,4.68182)])
dgm2 = d.Diagram([(5.96,3.48), (5.24,4.04), (5.24,4.04), (4.44,3.48)])
print d.bottleneck_distance(dgm1, dgm2)
print d.bottleneck_distance(dgm2, dgm1)
1.74330592155
1.73230612278

Best wishes,
Chen