Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Infinite bars? #30

Open
michiexile opened this issue Jul 24, 2022 · 4 comments
Open

Infinite bars? #30

michiexile opened this issue Jul 24, 2022 · 4 comments

Comments

@michiexile
Copy link

Where are the infinite length persistence bars? I tried out ripserr on a simple uniformly random point cloud, and get:

> phom
# A tibble: 119 × 3
   dimension birth    death
       <int> <dbl>    <dbl>
 1         0     0 0.000583
 2         0     0 0.000980
 3         0     0 0.00102 
 4         0     0 0.00206 
 5         0     0 0.00224 
 6         0     0 0.00228 
 7         0     0 0.00249 
 8         0     0 0.00282 
 9         0     0 0.00295 
10         0     0 0.00315 

Notably,

> max(phom$death)
[1] 0.0377396

But unless you are deliberately computing reduced (co)homology, you should expect to see at least one infinite bar in dimension 0. Are you quietly dropping all the infinite bars?!

Another experiment, with a circle point cloud:

> circle.phom = vietoris_rips(circle.cloud)
> circle.phom
PHom object containing persistence data for 200 features.

Contains:
* 199 0-dim features
* 1 1-dim feature

Radius/diameter: min = 0; max = 1.7333.

but if I restrict max-radius:

> circle.phom = vietoris_rips(circle.cloud, threshold=1.5)
> circle.phom
PHom object containing persistence data for 199 features.

Contains:
* 199 0-dim features

Radius/diameter: min = 0; max = 0.15284.

I would like to strongly urge you to implement tracking and reporting of infinite bars.

@corybrunson
Copy link
Collaborator

Thanks for pointing this out. I believe a Vietoris–Rips filtration always (except for the empty point cloud) produces a single infinite-persistence feature (of dimension zero), so no information is lost by reporting only the finite-persistence features. That said, and while i tend to think reduced PH should be the default, i agree that the user should be able to get the connected component feature if they want it.

I'm not familiar with the C++ source code, which might have evolved in Ripser since it was adapted for this package. Even if Ripser itself returns only reduced homology, it would be easy, within R, to augment the returned 'PHom' object with the connected component feature. And this can be done in the meantime before the source code here is upgraded.

@michiexile
Copy link
Author

michiexile commented Sep 13, 2022 via email

@corybrunson
Copy link
Collaborator

Ah, i see—the core issue is that all features that persist beyond the threshold are omitted from the output. Here's a smaller example:

library(ripserr)
pc <- cbind(c(0,1,0), c(0,0,2))
ph <- vietoris_rips(pc)
as.data.frame(ph)
#>   dimension birth death
#> 1         0     0     1
#> 2         0     0     2
ph <- vietoris_rips(pc, threshold = 1.5)
as.data.frame(ph)
#>   dimension birth death
#> 1         0     0     1

Created on 2022-09-13 by the reprex package (v2.0.1)

I agree that it would be more appropriate, at least by default, to include the births of these features, perhaps with NA rather than Inf death. (Would you suggest something different?) Though again i don't know if this can be done without upgrading the Ripser code. (That needs to be done anyway, but it ties into other issues and will require some committed time.)

@michiexile
Copy link
Author

michiexile commented Sep 15, 2022 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants