Skip to main content

Flood complex PH

Project description

Flooder

flooder is a Python package for constructing a lightweight filtered simplicial complex-the Flood complex-on Euclidean point cloud data, leveraging state-of-the-art GPU computing hardware, for subsequent persistent homology (PH) computation (using gudhi).

Currently, flooder allows computing Flood PH on millions of points in 3D (see Usage), enabling previously computationally infeasible large-scale applications of PH on point clouds. While flooder is primarily intended for 3D Euclidean point cloud data, it also works with Euclidean point cloud data of moderate dimension (e.g., 4,5,6). For theoretical guarantees of the Flood complex, including algorithmic details, see Citing.

Related Projects

If you are looking for fast implementations of (Vietoris-)Rips PH, see ripser, or the GPU-accelerated ripser++, respectively. In addition gudhi supports, e.g., computing Alpha PH also on fairly large point clouds (see the examples/example_01_cheese_3D.py for a runtime comparison).

Setup

Currently, flooder is available on pypi with wheels for Unix-based platforms. To install, type the following command into your environment (we do recommend a clean new Anaconda environment, e.g., created via conda create -n flooder-env python=3.9 -y):

pip install flooder

Local/Development build

In case you want to contribute to the project, we recommend checking out the flooder GitHub repository, and setting up the environment as follows:

git clone https://github.com/plus-rkwitt/flooder
conda create -n flooder-env python=3.9 -y
conda activate flooder-env
pip install -r requirements.txt

The previous commands will install all dependencies, such as torch, gudhi, numpy, fpsample and scipy. Once installed, you can run our examples from within the top-level flooder folder (i.e., the directory created when doing git clone) via

PYTHONPATH=. python examples/example_01_cheese_3D.py

Alternatively, you can also do a pip install -e . for a local editable build. Note that the latter command will already install all required dependencies (so, there is no need to do a pip install -r requirements.txt).

Optional dependencies

In case you want to plot persistence diagrams, we recommend using persim, which can be installed via

pip install persim

Usage

In the following example, we compute Flood PH on 2M points from a standard multivariate Gaussian in 3D, using 1k landmarks, and finally plot the diagrams up to dimension 2. You could, e.g., just copy-paste the following code into a Jupyter notebook (note that, in case you just checked out the GitHub repository and did not do a pip install flooder, the notebook would need to be in the top-level directory for all imports to work).

from flooder import (
    generate_noisy_torus_points, 
    flood_complex, 
    generate_landmarks)

DEVICE = "cuda"
n_pts = 1_000_000  # Number of points to sample from torus
n_lms = 1_000      # Number of landmarks for Flood complex

pts = generate_noisy_torus_points(n_pts).to(DEVICE)
lms = generate_landmarks(pts, n_lms)

stree = flood_complex(pts, lms, return_simplex_tree=True)
stree.compute_persistence()
ph = [stree.persistence_intervals_in_dimension(i) for i in range(3)]

Importantly, one can either call flood_complex with the already pre-selected (here via FPS) landmarks, or one can just specify the number of desired landmarks, e.g., via

n_lms = 1_000
stree = flood_complex(pts, n_lms, return_simplex_tree=True)

License

The code is licensed under an MIT license.

Citing

Please cite the following arXiv preprint in case you flooder useful for your applications.

coming soon!

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

flooder-1.0rc5.tar.gz (16.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

flooder-1.0rc5-py3-none-any.whl (15.6 kB view details)

Uploaded Python 3

File details

Details for the file flooder-1.0rc5.tar.gz.

File metadata

  • Download URL: flooder-1.0rc5.tar.gz
  • Upload date:
  • Size: 16.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.9.23

File hashes

Hashes for flooder-1.0rc5.tar.gz
Algorithm Hash digest
SHA256 28d7d4c1ab1f14d91434de04ca487b79d6cc072820000ddf782852baac0f3d1d
MD5 5a3021101969c7d9845b6add4cb80ac7
BLAKE2b-256 6e17758e1bc7a1b5da2ee2b8c2b1e7d6ce7ecee5806365fd44a1db17ac1f7bbd

See more details on using hashes here.

File details

Details for the file flooder-1.0rc5-py3-none-any.whl.

File metadata

  • Download URL: flooder-1.0rc5-py3-none-any.whl
  • Upload date:
  • Size: 15.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.9.23

File hashes

Hashes for flooder-1.0rc5-py3-none-any.whl
Algorithm Hash digest
SHA256 571df716aeb552df7e0ded40233a797b10ac1660f300726fb81de378c6c8d0b5
MD5 0f3aed6278b52aebb6e0430bd58bbe78
BLAKE2b-256 b267ff93d10b6268b8c296b6f05f90fa7fc65ee8127bd56f8a01e82e0573f276

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page