Back to Devoured - April 27, 2026
DEVOURED
tda-mapper (GitHub Repo)

tda-mapper (GitHub Repo)

Data github.com
tda-mapper is a scikit-learn-compatible library that reveals hidden clusters and patterns in messy data using topological data analysis to create intuitive graph representations.
What: tda-mapper implements the Mapper algorithm from Topological Data Analysis, which transforms complex high-dimensional data into graph representations that reveal clusters, transitions, and structural patterns. It integrates with scikit-learn pipelines and offers multiple visualization backends including an interactive web app for exploring data without code.
Why it matters: Topological Data Analysis provides a different approach to understanding data structure that can reveal patterns invisible to traditional clustering or dimensionality reduction methods, particularly useful for exploratory analysis of complex or high-dimensional datasets.
Takeaway: Install via pip and try the live demo app, or integrate it into existing scikit-learn pipelines for topological feature extraction on your own datasets.
Deep dive
  • The library implements the Mapper algorithm, which extracts topological structure from data by creating a graph representation that highlights clusters and transitions between them
  • Uses optimized spatial search techniques and parallelization to scale efficiently to high-dimensional datasets
  • Provides custom scikit-learn-compatible estimators that fit into standard ML pipelines for dimensionality reduction, clustering, and feature extraction
  • Supports multiple visualization backends (Plotly, Matplotlib, PyVis) with adjustable layouts for exploring the resulting graph structures
  • Includes an interactive web-based app for real-time parameter tuning and visualization without writing code
  • The Mapper algorithm works in four steps: choose a lens function (like PCA), cover the lens image with overlapping intervals, cluster data in each interval, and build a graph from overlapping clusters
  • Example use case demonstrates applying Mapper to concentric circles dataset, successfully identifying the two circles as connected components in the topological graph
  • Applications span social sciences, biology, and machine learning for discovering hidden relationships in complex data
  • Library is published on PyPI with documentation and accompanying research paper for methodological details
Decoder
  • TDA (Topological Data Analysis): A mathematical approach to data analysis that studies the shape and structure of data by examining topological features like connected components, holes, and clustering patterns
  • Mapper algorithm: A technique that creates a simplified graph representation of complex data by projecting it through a lens function, covering the projection with overlapping regions, clustering within each region, and connecting overlapping clusters
  • Lens: A function (often dimensionality reduction like PCA) that projects high-dimensional data to lower dimensions to help identify structure before clustering
  • Topological features: Structural properties of data like connectedness and clustering patterns that remain invariant under continuous deformations
Original article

tda-mapper

tda-mapper is a Python library built around the Mapper algorithm, a core technique in Topological Data Analysis (TDA) for extracting topological structure from complex data. Designed for computational efficiency and scalability, it leverages optimized spatial search methods to support high-dimensional datasets. The library is well-suited for integration into machine learning pipelines, unsupervised learning tasks, and exploratory data analysis.

Further details in the documentation and in the paper.

Core Features

  • Efficient construction

    Leverages optimized spatial search techniques and parallelization to accelerate the construction of Mapper graphs, supporting the analysis of high-dimensional datasets.

  • Scikit-learn integration

    Provides custom estimators that are fully compatible with scikit-learn's API, enabling seamless integration into scikit-learn pipelines for tasks such as dimensionality reduction, clustering, and feature extraction.

  • Flexible visualization

    Multiple visualization backends supported (Plotly, Matplotlib, PyVis) for generating high-quality Mapper graph representations with adjustable layouts and styling.

  • Interactive app

    Provides an interactive web-based interface for dynamic exploration of Mapper graph structures, offering real-time adjustments to parameters and visualizations.

Background

The Mapper algorithm extracts topological features from complex datasets, representing them as graphs that highlight clusters, transitions, and key structural patterns. These insights reveal hidden data relationships and are applicable across diverse fields, including social sciences, biology, and machine learning. For an in-depth overview of Mapper, including its mathematical foundations and practical applications, read the original paper.

Step 1 Step 2 Step 3 Step 4
Step 1 Step 2 Step 3 Step 2
Choose lens Cover image Run clustering Build graph

Quick Start

Installation

To install the latest version uploaded on PyPI

pip install tda-mapper

How to Use

Here's a minimal example using the circles dataset from scikit-learn to demonstrate how to use tda-mapper. This example demonstrates how to apply the Mapper algorithm on a synthetic dataset (concentric circles). The goal is to extract a topological graph representation using PCA as a lens and DBSCAN for clustering. We proceed as follows:

import matplotlib.pyplot as plt
from sklearn.datasets import make_circles

import numpy as np
from sklearn.decomposition import PCA
from sklearn.cluster import DBSCAN

from tdamapper.learn import MapperAlgorithm
from tdamapper.cover import CubicalCover
from tdamapper.plot import MapperPlot

# Generate toy dataset
X, labels = make_circles(n_samples=5000, noise=0.05, factor=0.3, random_state=42)
plt.figure(figsize=(5, 5))
plt.scatter(X[:,0], X[:,1], c=labels, s=0.25, cmap="jet")
plt.axis("off")
plt.show()

# Apply PCA as lens
y = PCA(2, random_state=42).fit_transform(X)

# Mapper pipeline
cover = CubicalCover(n_intervals=10, overlap_frac=0.3)
clust = DBSCAN()
graph = MapperAlgorithm(cover, clust).fit_transform(X, y)

# Visualize the Mapper graph
fig = MapperPlot(graph, dim=2, seed=42, iterations=60).plot_plotly(colors=labels)
fig.show(config={"scrollZoom": True})
Original Dataset Mapper Graph
Original Dataset Mapper Graph

Left: the original dataset consisting of two concentric circles with noise, colored by class label. Right: the resulting Mapper graph, built from the PCA projection and clustered using DBSCAN. The two concentric circles are well identified by the connected components in the Mapper graph.

More examples can be found in the documentation.

Interactive App

Use our app to interactively visualize and explore your data without writing code. You can try it right away using our live demo, or run it locally on your machine.

To run it locally:

  1. Install the app and its dependencies:

    pip install tda-mapper[app]
  2. Launch the app:

    tda-mapper-app

tda-mapper-app

Citations

If you use tda-mapper in your work, please consider citing both the library, archived in a permanent Zenodo record, and the paper, which provides a broader methodological overview. We recommend citing the specific version of the library used in your research, along with the paper. For citation examples, please refer to the documentation.

Explore all 66 articles in today's digest

Fresh dev news, AI-digested daily. Never miss a trend at devoured.fyi