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:

  • Python-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.0.1.tar.gz (132.9 kB view details)

Uploaded Source

Built Distribution

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

kmapper-2.0.1-py3-none-any.whl (126.0 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: kmapper-2.0.1.tar.gz
  • Upload date:
  • Size: 132.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.0.1 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.9.5

File hashes

Hashes for kmapper-2.0.1.tar.gz
Algorithm Hash digest
SHA256 dc809eb7908f2aff63cebfe3a699ee4b8229b17b4601be4b9827f540b6423ede
MD5 f8d1054ab9253d2167a95d3e39d4297e
BLAKE2b-256 727ed3ff347d053fd60f13c42522e7264b8bc3003c3e389cf61745274447a0d1

See more details on using hashes here.

File details

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

File metadata

  • Download URL: kmapper-2.0.1-py3-none-any.whl
  • Upload date:
  • Size: 126.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.0.1 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.9.5

File hashes

Hashes for kmapper-2.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 411edc078a25372fcde368e87deb460c9e1ffca94f4f02d60411ac284e17253b
MD5 4efdd556d21b789db84571a86884f9b7
BLAKE2b-256 16a70bdc98e01a842d0d8028cd1196bb84baeb08a673193b54b19ac50daa5a5c

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