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
Unexpected homology of boundary of a cube #20
Comments
Hi Morten, this is a duplicate of #16. In fact, surprisingly, in this example there is no nontrivial homology in degree 2, so the computation is correct. |
Hi Morten, thanks for pointing this out. Can you attach a point cloud to run it in C++ Ripser? Best, Uli |
Hi Uli, yes I can. First, I checked that GUDHI behaves differently, and indeed it does. Below I paste in the python code I used in a jupyter notebook. In the next comment I will paste in the point cloud. import gudhi def cube_surface(dimension=2, num_segment_points=3): rips_complex = gudhi.RipsComplex(points=cube_surface(dimension=2, num_segment_points=3), simplex_tree = rips_complex.create_simplex_tree(max_dimension=2) diag = simplex_tree.persistence(homology_coeff_field=2, min_persistence=0) coords = cube_surface(dimension=2, num_segment_points=3) plot_dgms(rips['dgms']) |
[[0.0, 0.0, 0.0], |
This time I used a 2 by 2 grid on each face of the cube. It suffices to obtain the unexpected behaviour. I hope this will be easy to fix. |
Hi Morten, I ran Ripser on this data set. The class in degree 2 shows up, but its interval is [0.5,1), so your threshold 0.4 is too small to see it. Guhdi might use a different scaling (radius instead of diameter as the parameter). |
I failed to reproduce when I had no threshold parameter. The threshold parameter is the culpit. This succeeds: array([[0.35355338, 1. ]]) This fails: array([[0.35355338, 0.5 ], |
Here I have added more grid points. I will see if I can reproduce the behaviour with 3 times 3 grids. |
Indeed, on the data I sent you, setting thresh=1.2 yields the following classes: With no threshold it yields the class |
Now I tested this data in live ripser, and there I got the expected result. With and without threshold. |
Ripser from command line also gives the expected output. |
Could you please file a report at https://github.com/scikit-tda/ripser.py/issues? |
When a regular grid of the boundary of the 3-cube is fed into ripser, the expected 2-dimensional homology class does not appear.
Sample code: (Python interface)
from ripser import ripser, plot_dgms
n=3
segment = [np.linspace(0,1,20)]
endpoints = [np.linspace(0,1,2)]
face = segment * (n - 1) + endpoints
corners = []
for k in range(n):
corners.extend(itertools.product(*(face[k:] + face[:k])))
coords = np.array(corners)
rips = ripser(coords, maxdim=2, thresh=.4)
plot_dgms(rips['dgms'])
The text was updated successfully, but these errors were encountered: