Skip to main content

Python implementation of Mapper algorithm for Topological Data Analysis.

Project description

PyPI version Downloads Build Status Codecov 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 (>= 2.7 or >= 3.3)
  • 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.

Cite

Nathaniel Saul, & Hendrik Jacob van Veen. (2017, November 17). MLWave/kepler-mapper: 186f (Version 1.0.1). Zenodo. http://doi.org/10.5281/zenodo.1054444

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-1.4.0.tar.gz (97.0 kB view details)

Uploaded Source

Built Distribution

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

kmapper-1.4.0-py3-none-any.whl (93.3 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: kmapper-1.4.0.tar.gz
  • Upload date:
  • Size: 97.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.20.1 setuptools/39.0.1 requests-toolbelt/0.9.1 tqdm/4.48.2 CPython/3.7.1

File hashes

Hashes for kmapper-1.4.0.tar.gz
Algorithm Hash digest
SHA256 4bec945bffb0cee0503ef3c246fc5179523e874f86dd7769e987812f59ef973d
MD5 8bda45921d5b426c8d1491be7c1c3e2f
BLAKE2b-256 e4e207a2cafa874b0e1b5450aa8b0e852470d231a9ff1f81dc9186330fd1f3a3

See more details on using hashes here.

File details

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

File metadata

  • Download URL: kmapper-1.4.0-py3-none-any.whl
  • Upload date:
  • Size: 93.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.20.1 setuptools/39.0.1 requests-toolbelt/0.9.1 tqdm/4.48.2 CPython/3.7.1

File hashes

Hashes for kmapper-1.4.0-py3-none-any.whl
Algorithm Hash digest
SHA256 dcc13a0254bbaabb2739af3a7d276fd2ac6ac793502704b30dd24d299dff3682
MD5 24269ac96934466f47a8640d94264adf
BLAKE2b-256 9e1ecd1fe1e939539f2bf9224bfa4bbeb517ac158c45c4829a2b05c982ff97a8

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