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).

import torch
import gudhi
from persim import plot_diagrams
from flooder import flood_complex, generate_landmarks

device = torch.device("cuda")

pts = torch.randn((2000000,3), device=device)
lms = generate_landmarks(pts, 1000)
out_complex = flood_complex(
    lms.to(device), 
    pts.to(device), 
    dim=3, 
    batch_size=16)

st = gudhi.SimplexTree()
for simplex in out_complex:
    st.insert(simplex, out_complex[simplex])
st.make_filtration_non_decreasing()
st.compute_persistence()

diags = [st.persistence_intervals_in_dimension(i) for i in range(3)]
plot_diagrams(diags)

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.0rc1.tar.gz (15.7 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.0rc1-py3-none-any.whl (15.4 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for flooder-1.0rc1.tar.gz
Algorithm Hash digest
SHA256 729c729e7a60f328032087057291634bde585c8e60f5a7ad25e8bf292d3cb0c4
MD5 cff690f096c8d6ac047127b0cd53fb2c
BLAKE2b-256 660622b5d200265642adb4c40ba77d4806e0b0a764d8d1027fb3a0097bfc966c

See more details on using hashes here.

File details

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

File metadata

  • Download URL: flooder-1.0rc1-py3-none-any.whl
  • Upload date:
  • Size: 15.4 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.0rc1-py3-none-any.whl
Algorithm Hash digest
SHA256 74de64219f2d9273185d208946d02daf4e90b5ea64f858d1670f3e9e726c8891
MD5 2199b5e7fe4a67e41942ac7410f01573
BLAKE2b-256 32c902426fa6b5aeeb699e20a14a57b7f0074ca27fc4f10583892963f8cd7b6a

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