-
Notifications
You must be signed in to change notification settings - Fork 1
Home
This tutorial accompanies the paper "A fractal dimension for measures via persistent homology" by Henry Adams, Manuchehr Aminian, Elin Farnell, Michael Kirby, Chris Peterson, Joshua Mirth, Rachel Neville, and Clayton Shonkwiler, which is available at https://arxiv.org/abs/1808.01079. The tutorial relies on code from Ripser (https://github.com/Ripser/ripser).

We will be using Ripser (https://github.com/Ripser/ripser) in this tutorial. Some slides about how Ripser works are available at http://ulrich-bauer.org/ripser-talk.pdf.
The easiest way to run Ripser is in a live demo in your browser, for which no instalation (and in particular, no Python) is required. Try it out! The webpage is http://live.ripser.org/.
For example, we can use Ripser to compute the persistent homology of the Vietoris-Rips complex of the following 5 points in the plane.

The file house_points.txt is in the folder PHdimension/persistent-homology/point_clouds. It is the 5x2 matrix corresponding to the above collection of 5 points in the plane; the entries of this file are
1, 0
1, 2
0, 3
-1, 2
-1, 0
At the Ripser live webpage, enter the following input
Be sure to select the option point cloud!
Note that the 5 connected components merge into one, with merging events happening at scales (the square root of 2) and 2. There is a single 1-dimensional feature, beginning at scale parameter 2 and ending at scale parameter (the square root of 8).
The following example computes the persistent homology barcodes of a 20 x 20 grid of 400 points on the unit torus S1 x S1 in R4, where a small amount of noise has been added to each point. Only a subset of the intervals are shown below.
Note that the long barcodes (roughly between scale parameter 0.7 and 1.5) recover the homology of the torus, with a single connected component, with two 1-dimensional holes, and with a single 2-dimensional hole.
A more advanced (but very useful) step is to now download Ripser to your machine and to run it locally. This allows you to perform larger computations. Ripser is written in C++. You may download the code for Ripser at https://github.com/Ripser/ripser, which also contains installation instructions. Minimal installation instructions are listed below
git clone https://github.com/Ripser/ripser.git
cd ripser
make
./ripser examples/sphere_3_192.lower_distance_matrix
For convenience, copy the Unix executable file ripser into the folder Top-ML/persistent-homology. You can use the flag --format distances to specify you are computing on a distance matrix, or --format point-cloud to specify you are computing on a point cloud. The flag --dim k specifies that homology is computed only up to dimension k, and the flag --threshold t specifies that persistent homology is computed only up to scale parameter t. For example, we can recreate all of the examples above with the following commands.
House example on the point cloud:
./ripser --format point-cloud point_clouds/house_points.txt
Torus example, up to 2-dimensional homology:
./ripser --format point-cloud --dim 2 point_clouds/torus_points.txt
Exercise: Write a script that selects 500 points uniformly at random (or approximately uniformly at random) from the annulus {(x,y)|0.92≤x2+y2≤1.12} in R2. Compute its persistent homology barcodes using ripser.
Exercise: Write a script (say in Python, or some other language) that selects 500 points uniformly at random (or approximately uniformly at random) from the "coconut shell" {(x,y,z)|0.92≤x2+y2+z2≤1.12} in R3. Compute its persistent homology barcodes using ripser.
M. A. Armstrong. Basic Topology. Springer, New York, Berlin, 1983.
H. Edelsbrunner and J. Harer. Computational Topology: An Introduction. American Mathematical Society, Providence, 2010.
H. Edelsbrunner, D. Letscher, and A. Zomorodian. Topological persistence and simplification. Discrete Comput. Geom., 28:511-533, 2002.
A. Hatcher. Algebraic Topology. Cambridge University Press, Cambridge, 2002.
A. Zomorodian. Advances in Applied and Computational Topology. American Mathematical Society, 2012.
A. Zomorodian and G. Carlsson. Computing persistent homology. Discrete Comput. Geom., 33:249-274, 2005.