Topics

Difference between R TDA package and python Dionysus2

K.A.Garside2@...
 

I've just been comparing the output between the Dionysus version in the TDA package in R and the python Dionysus 2 version and there are slightly different results.

I ran it on both sub and super level set filtration on a random field and got slightly different results. Is there a reason for the differences between the R and python implementation?

The 6x6 random field was as follows:

0.424929227922883 0.0128508228081597 -0.294177345297659 -0.49885453849692 -0.442318052990762 -0.626453810742332
0.201060103852361 -0.00595309362438814 -0.286812470518481 -0.845635155782885 -0.328884989662953 -0.539250210004794
0.172361359893672 0.0791446149595664 0.0298949263564899 -0.208043570082747 -0.280335952479328 -0.770728999699832
-0.0263036491145396 -0.158923878454222 0.239839365534883 -0.124288608608425 -0.289240676712963 -0.241020973140624
-0.423771084401562 -0.155098230023893 0.239843914614278 0.0208525497197847 0.14293072464965 -0.127618257296956
-0.371494249200723 -0.0954999907866207 -0.213831055439932 0.268132722688926 0.0128755839751564 -0.374495881349471


R gives the following diagrams:
# Sub level set:
     dimension      Birth       Death
[1,]         0 -0.8456352  0.42492923
[2,]         0 -0.7707290 -0.44231805
[3,]         0 -0.6264538 -0.53925021
[4,]         0 -0.4237711  0.02989493
[5,]         0 -0.3744959 -0.12761826
[6,]         0 -0.2892407 -0.28033595
[7,]         0 -0.2138311 -0.09549999

# Super level set
     dimension       Death      Birth
[1,]         0 -0.84563516  0.4249292
[2,]         0  0.02989493  0.2681327
[3,]         1 -0.28924068 -0.2803360
[4,]         1 -0.84563516 -0.4988545


Whilst the python Dionysus2 version gives:
# Sub level set 
0 -0.845635175704956 Inf
0 -0.7707290053367615 -0.44231805205345154
0 -0.6264538168907166 -0.5392501950263977
0 -0.42377108335494995 0.07914461195468903
0 -0.37449589371681213 -0.12761825323104858
0 -0.28924068808555603 -0.2803359627723694
0 -0.21383105218410492 -0.15509822964668274
0 -0.15892387926578522 -0.15509822964668274
1 0.020852549001574516 0.14293073117733002

# Super level set
0 0.4249292314052582 -Inf
0 0.2681327164173126 0.07914461195468903
0 0.14293073117733002 0.020852549001574516
0 -0.09549999237060547 -0.15509822964668274
1 -0.15509822964668274 -0.15892387926578522
1 -0.2803359627723694 -0.28924068808555603
1 -0.49885454773902893 -0.845635175704956
 

Dmitriy Morozov
 

I don't know what the R package does, but if I had to guess, the two are using different triangulations of the domain. Dionysus 2 uses the Freudenthal triangulation; I don't know what the R package does. 


On Thu, May 30, 2019 at 11:23 AM <K.A.Garside2@...> wrote:
I've just been comparing the output between the Dionysus version in the TDA package in R and the python Dionysus 2 version and there are slightly different results.

I ran it on both sub and super level set filtration on a random field and got slightly different results. Is there a reason for the differences between the R and python implementation?

The 6x6 random field was as follows:

0.424929227922883 0.0128508228081597 -0.294177345297659 -0.49885453849692 -0.442318052990762 -0.626453810742332
0.201060103852361 -0.00595309362438814 -0.286812470518481 -0.845635155782885 -0.328884989662953 -0.539250210004794
0.172361359893672 0.0791446149595664 0.0298949263564899 -0.208043570082747 -0.280335952479328 -0.770728999699832
-0.0263036491145396 -0.158923878454222 0.239839365534883 -0.124288608608425 -0.289240676712963 -0.241020973140624
-0.423771084401562 -0.155098230023893 0.239843914614278 0.0208525497197847 0.14293072464965 -0.127618257296956
-0.371494249200723 -0.0954999907866207 -0.213831055439932 0.268132722688926 0.0128755839751564 -0.374495881349471


R gives the following diagrams:
# Sub level set:
     dimension      Birth       Death
[1,]         0 -0.8456352  0.42492923
[2,]         0 -0.7707290 -0.44231805
[3,]         0 -0.6264538 -0.53925021
[4,]         0 -0.4237711  0.02989493
[5,]         0 -0.3744959 -0.12761826
[6,]         0 -0.2892407 -0.28033595
[7,]         0 -0.2138311 -0.09549999

# Super level set
     dimension       Death      Birth
[1,]         0 -0.84563516  0.4249292
[2,]         0  0.02989493  0.2681327
[3,]         1 -0.28924068 -0.2803360
[4,]         1 -0.84563516 -0.4988545


Whilst the python Dionysus2 version gives:
# Sub level set 
0 -0.845635175704956 Inf
0 -0.7707290053367615 -0.44231805205345154
0 -0.6264538168907166 -0.5392501950263977
0 -0.42377108335494995 0.07914461195468903
0 -0.37449589371681213 -0.12761825323104858
0 -0.28924068808555603 -0.2803359627723694
0 -0.21383105218410492 -0.15509822964668274
0 -0.15892387926578522 -0.15509822964668274
1 0.020852549001574516 0.14293073117733002

# Super level set
0 0.4249292314052582 -Inf
0 0.2681327164173126 0.07914461195468903
0 0.14293073117733002 0.020852549001574516
0 -0.09549999237060547 -0.15509822964668274
1 -0.15509822964668274 -0.15892387926578522
1 -0.2803359627723694 -0.28924068808555603
1 -0.49885454773902893 -0.845635175704956
 

K.A.Garside2@...
 

The R package states that it uses Dionysus as a library however? I assume that means it is not using Dionysus 2?

" For that, this package provides an R interface for the efficient algorithms of the C++ libraries 'GUDHI' <http://gudhi.gforge.inria.fr/>, 'Dionysus' <http://www.mrzv.org/software/dionysus/>, and 'PHAT' <https://bitbucket.org/phat-code/phat/>. "

Dmitriy Morozov
 

The R package uses Dionysus 1, for sure. Dionysus 1 doesn't have any code to construct triangulations on grids: it's left to the user. How the R package implements this step is a question for its authors.


On Fri, May 31, 2019 at 6:23 AM <K.A.Garside2@...> wrote:
The R package states that it uses Dionysus as a library however? I assume that means it is not using Dionysus 2?

" For that, this package provides an R interface for the efficient algorithms of the C++ libraries 'GUDHI' <http://gudhi.gforge.inria.fr/>, 'Dionysus' <http://www.mrzv.org/software/dionysus/>, and 'PHAT' <https://bitbucket.org/phat-code/phat/>. "