Skip to main content

Statistical hypothesis testing for persistence diagrams and barcodes

Project description

TDA-PHANTOM

Topological data analysis - Persistent Homology Analysis via Null Testing On Manifolds (TDA-PHANTOM) is a tool for statistically analysing significance of persistence diagrams and barcodes.

This project implements hypothesis tests from:

Installation

Via PyPI:

pip install tdaphantom

Or you can clone this repository and install it manually:

python setup.py install

Overview

This tool can build a Vietoris-Rips complex from either a point cloud or distance matrix.

It can then be used to visualise the persistence diagram for that complex, and run various hypothesis tests for it.

The results of these hypothesis tests can be analysed via a return results array, or visualised in a signifiance persistence diagram.

Example Usage

Generate data

def _make_circle(n=2000, noise=0.03, seed=1):
    rng   = np.random.default_rng(seed)
    theta = rng.uniform(0, 2 * np.pi, n)
    pts   = np.stack([np.cos(theta), np.sin(theta)], axis=1)
    return pts + rng.normal(0, noise, pts.shape)

pc_circle = _make_circle()

Init Phantom class

phantom_circle = Phantom(pc_circle)

Calculate persistence diagram

Here we go up to homological dimension 1

phantom_circle.calculate_dgms_from_point_cloud_ripser(k=1)

Display persistence diagram

phantom_circle.display_dgms()

Persistence diagram for a circle using phatom

Run hypothesis test

alpha      = 0.01
correction = None
methods    = ["universal_null"]

phantom_circle.hypothesis_test(alpha, correction_method=correction, methods=methods, k=1)

Display signifiance persistence diagram

phantom_circle.display_results()

signifiance Persistence diagram for a circle using phatom

Basic useage

Avaliable methods

Universal null median

Useage

Theory

Universal null mean

Useage

Theory

Bottleneck subsampling

Useage

Theory

TODO

  • Add bottleneck shells
  • Add bottleneck density
  • Add bottleneck concentration
  • Add more integeration tests
  • Add more unit tests

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

tdaphantom-1.0.0.tar.gz (14.5 kB view details)

Uploaded Source

Built Distribution

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

tdaphantom-1.0.0-py3-none-any.whl (15.7 kB view details)

Uploaded Python 3

File details

Details for the file tdaphantom-1.0.0.tar.gz.

File metadata

  • Download URL: tdaphantom-1.0.0.tar.gz
  • Upload date:
  • Size: 14.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.9

File hashes

Hashes for tdaphantom-1.0.0.tar.gz
Algorithm Hash digest
SHA256 460eb6faf54ac0371df46e860a330a40baa83b6753d8b125ac70b987fa7ef7d0
MD5 1d49868dd838510e59c4742500cded71
BLAKE2b-256 47f2ab0ea1af620fa8019a5db7d3c181904664c4a256075cd0b6c4115379202a

See more details on using hashes here.

File details

Details for the file tdaphantom-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: tdaphantom-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 15.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.9

File hashes

Hashes for tdaphantom-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 f885f166bf2ad02289bb29fc0917c45a5b7f4f51785de5cfdec658afdf6f9b4e
MD5 dc3d83e90eecd4e07264cfc53f895c11
BLAKE2b-256 51d31e976faaf386a301d30f0e6c61ce4737517fcc8b979e261a95d8e4cf72d8

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