Skip to main content

Python implementation of Mapper algorithm for Topological Data Analysis.

Project description

PyPI version Downloads Build Status Codecov DOI DOI

KeplerMapper

Nature uses as little as possible of anything. - Johannes Kepler

This is a Python implementation of the TDA Mapper algorithm for visualization of high-dimensional data. For complete documentation, see https://kepler-mapper.scikit-tda.org.

KeplerMapper employs approaches based on the Mapper algorithm (Singh et al.) as first described in the paper "Topological Methods for the Analysis of High Dimensional Data Sets and 3D Object Recognition".

KeplerMapper can make use of Scikit-Learn API compatible cluster and scaling algorithms.

Install

Dependencies

KeplerMapper requires:

  • Python (>= 3.6)
  • NumPy
  • Scikit-learn

Using the plotly visualizations requires a few extra libraries:

  • igraph
  • Plotly
  • Ipywidgets

Additionally, running some of the examples requires:

  • matplotlib
  • umap-learn

Installation

Install KeplerMapper with pip:

pip install kmapper

To install from source:

git clone https://github.com/MLWave/kepler-mapper
cd kepler-mapper
pip install -e .

Usage

KeplerMapper adopts the scikit-learn API as much as possible, so it should feel very familiar to anyone who has used these libraries.

Python code

# Import the class
import kmapper as km

# Some sample data
from sklearn import datasets
data, labels = datasets.make_circles(n_samples=5000, noise=0.03, factor=0.3)

# Initialize
mapper = km.KeplerMapper(verbose=1)

# Fit to and transform the data
projected_data = mapper.fit_transform(data, projection=[0,1]) # X-Y axis

# Create dictionary called 'graph' with nodes, edges and meta-information
graph = mapper.map(projected_data, data, cover=km.Cover(n_cubes=10))

# Visualize it
mapper.visualize(graph, path_html="make_circles_keplermapper_output.html",
                 title="make_circles(n_samples=5000, noise=0.03, factor=0.3)")

Disclaimer

Standard MIT disclaimer applies, see DISCLAIMER.md for full text. Development status is Alpha.

How to cite

To credit KeplerMapper in your work: https://kepler-mapper.scikit-tda.org/en/latest/#citations

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

kmapper-2.1.0.tar.gz (134.0 kB view details)

Uploaded Source

Built Distribution

kmapper-2.1.0-py3-none-any.whl (126.8 kB view details)

Uploaded Python 3

File details

Details for the file kmapper-2.1.0.tar.gz.

File metadata

  • Download URL: kmapper-2.1.0.tar.gz
  • Upload date:
  • Size: 134.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/5.1.0 CPython/3.12.4

File hashes

Hashes for kmapper-2.1.0.tar.gz
Algorithm Hash digest
SHA256 d78df18e176b2ef21edf0ea9f815bae1bf277e7b3a805b76bd1263fbcd05e3a3
MD5 b5b69604897239e645a738b06d3e02ef
BLAKE2b-256 db1f142bb0c049239d6d35997909a219d22b1ee456091523bf2ef289083595ea

See more details on using hashes here.

File details

Details for the file kmapper-2.1.0-py3-none-any.whl.

File metadata

  • Download URL: kmapper-2.1.0-py3-none-any.whl
  • Upload date:
  • Size: 126.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/5.1.0 CPython/3.12.4

File hashes

Hashes for kmapper-2.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 b0d7cd3289b3ee17a75bed0dfbe5761fd3599e42508e0ddee410868233bfc66a
MD5 164941be16be86aeb5d5ec882d930127
BLAKE2b-256 4e91b0e43c9fcfee52024664a7b117ccf9fd3644f8cdd5d758620c21a5f4c406

See more details on using hashes here.

Supported by

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