Python bindings for Hera
Project description
Hera-TDA
Python bindings for Hera, a library for fast calculation of bottleneck distance and Wasserstein distance on persistence diagrams.
These bindings can be used with standard Python types (lists of lists). These bindings are also compatible with BATS.
Note that Hera is also used in Dionysus 2 for bottleneck distance computation.
Installation
You first need to install boost headers for Hera
dnf install boost-devel # fedora
pip install
pip install hera-tda
This will compile binaries.
Build from source
Then, do a recursive clone for submodules
git clone --recursive git@github.com:CompTop/pyhera.git
then you can install to your Python environment
python setup.py install
Basic Example
Bottleneck Distance
After installation, the package is available under the hera_tda
namespace.
import hera_tda as hera
import hera_tda.bottleneck
pX = [[1.0, 2.0], [2.0,3.0]] # diagram 1
pY = [[1.1, 2.1], [2.1, 3.1]] # diagram 2
d, inds = hera.bottleneck.BottleneckDistance(pX, pY)
# d = 0.1
d
is the computed bottleneck distance
inds
is a tuple containing the indices of pX
and pY
that were the maximum-weight matching (-1
is used to indicate a diagonal point).
Wasserstein Distance
from hera_tda.wasserstein import WassersteinDistance
pX = [[1.0, 2.0], [2.0,3.0]]
pY = [[1.1, 2.1], [2.1, 3.1]]
p = 2.0 # wasserstein-p
d = WassersteinDistance(pX, pY, p)
# d = 0.1414...
WassersteinDistance
just returns the distance. There is no matching.
Additional Examples
See demo.ipynb and wasserstein.ipynb
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distributions
File details
Details for the file hera-tda-0.0.2.tar.gz
.
File metadata
- Download URL: hera-tda-0.0.2.tar.gz
- Upload date:
- Size: 413.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/29.0 requests/2.25.1 requests-toolbelt/0.9.1 urllib3/1.26.7 tqdm/4.59.0 importlib-metadata/4.8.2 keyring/23.1.0 rfc3986/1.5.0 colorama/0.4.4 CPython/3.7.10
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | eacda383a28039bcc661fa9ff37a8e6cc67fd249724af29c7af8a264d3360d08 |
|
MD5 | 6cba98115d55f208a32d5729faf58edc |
|
BLAKE2b-256 | 8b21aee1e045c140ec0d539b26825bd0d0dcb080224cb8cc4d1d626906819cf0 |
File details
Details for the file hera_tda-0.0.2-pp38-pypy38_pp73-manylinux_2_24_x86_64.whl
.
File metadata
- Download URL: hera_tda-0.0.2-pp38-pypy38_pp73-manylinux_2_24_x86_64.whl
- Upload date:
- Size: 2.4 MB
- Tags: PyPy, manylinux: glibc 2.24+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/29.0 requests/2.25.1 requests-toolbelt/0.9.1 urllib3/1.26.7 tqdm/4.59.0 importlib-metadata/4.8.2 keyring/23.1.0 rfc3986/1.5.0 colorama/0.4.4 CPython/3.7.10
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 15dbf3f56923b0afef3062cef173cf8fa09eb95d82ad98d104d61709f3e50b4f |
|
MD5 | 9bf204c5b1a77901136402306367cfa2 |
|
BLAKE2b-256 | bc3793412b3f92b73bc7bff2532a5998990aa24544c1424854032d89aec9e6c3 |
File details
Details for the file hera_tda-0.0.2-cp310-cp310-manylinux_2_24_x86_64.whl
.
File metadata
- Download URL: hera_tda-0.0.2-cp310-cp310-manylinux_2_24_x86_64.whl
- Upload date:
- Size: 2.2 MB
- Tags: CPython 3.10, manylinux: glibc 2.24+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/29.0 requests/2.25.1 requests-toolbelt/0.9.1 urllib3/1.26.7 tqdm/4.59.0 importlib-metadata/4.8.2 keyring/23.1.0 rfc3986/1.5.0 colorama/0.4.4 CPython/3.7.10
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | b21dc4548663872aa87b0a3a24cd6a92e5a375caced4e624ab20bbabe660def4 |
|
MD5 | 98fbcf81b4ded87a1eaa480b61dfa561 |
|
BLAKE2b-256 | 269bb978bde070693f27b4b449812c90dccfee44c3e5b38eb8e2fa51f9429eef |
File details
Details for the file hera_tda-0.0.2-cp39-cp39-manylinux_2_24_x86_64.whl
.
File metadata
- Download URL: hera_tda-0.0.2-cp39-cp39-manylinux_2_24_x86_64.whl
- Upload date:
- Size: 2.2 MB
- Tags: CPython 3.9, manylinux: glibc 2.24+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/29.0 requests/2.25.1 requests-toolbelt/0.9.1 urllib3/1.26.7 tqdm/4.59.0 importlib-metadata/4.8.2 keyring/23.1.0 rfc3986/1.5.0 colorama/0.4.4 CPython/3.7.10
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 83faabf147159f334e61d389a9defb454c56c40e00d7274a917294c0ea554956 |
|
MD5 | 0c8c174ea4f15d83224975e354eade88 |
|
BLAKE2b-256 | e57c2763db98875b6e08b55cb1e0c7ee5b485bc13d9d464427a481e3d87ad40b |
File details
Details for the file hera_tda-0.0.2-cp38-cp38-manylinux_2_24_x86_64.whl
.
File metadata
- Download URL: hera_tda-0.0.2-cp38-cp38-manylinux_2_24_x86_64.whl
- Upload date:
- Size: 2.4 MB
- Tags: CPython 3.8, manylinux: glibc 2.24+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/29.0 requests/2.25.1 requests-toolbelt/0.9.1 urllib3/1.26.7 tqdm/4.59.0 importlib-metadata/4.8.2 keyring/23.1.0 rfc3986/1.5.0 colorama/0.4.4 CPython/3.7.10
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 455da3269b6eb221a8d6d4b8b77001e8ae8b59de6be6a7085afbe6c6afe5e782 |
|
MD5 | 907360b8db927c5fb3cd13607619680b |
|
BLAKE2b-256 | 487cb88b198bcf4bd5b6aa8c803b484c59827cb10dc962f7b1942c9f3d15e3f4 |
File details
Details for the file hera_tda-0.0.2-cp36-cp36m-manylinux_2_24_x86_64.whl
.
File metadata
- Download URL: hera_tda-0.0.2-cp36-cp36m-manylinux_2_24_x86_64.whl
- Upload date:
- Size: 2.2 MB
- Tags: CPython 3.6m, manylinux: glibc 2.24+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/29.0 requests/2.25.1 requests-toolbelt/0.9.1 urllib3/1.26.7 tqdm/4.59.0 importlib-metadata/4.8.2 keyring/23.1.0 rfc3986/1.5.0 colorama/0.4.4 CPython/3.7.10
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4756919ccc5a222d8bf73ece744381d2e90683c97e8b11b0f8238b781b035178 |
|
MD5 | fc52da35b658b60d88196838d8f7c574 |
|
BLAKE2b-256 | c2bce6ea269a698ce42f250a4d8d61f0079c8302051d1c04a4a2c878acc34e73 |