tda-mapper — Topological Data Analysis Mapper Algorithm

복잡한 고차원 데이터셋에서 위상학적 구조(그래프)를 추출하는 Python 구현체. 클러스터, 전환, 구조적 패턴을 발견하는 TDA 핵심 기법.

Core Features

  • Efficient Construction: 최적화된 공간 검색 및 병렬화로 고차원 데이터 처리
  • Scikit-learn Integration: 커스텀Estimator로 파이프라인 통합 가능 (차원축소 + 클러스터링)
  • Flexible Visualization: Plotly, Matplotlib, PyVis 멀티 백엔드 지원
  • Interactive Web App: 코드 없이 Mapper 그래프를 동적으로 탐색하는 웹 인터페이스 내장

The Mapper Workflow

4단계 프로세스로 데이터를 위상학적 그래프로 변환:

  1. Choose Lens: 데이터를 저차원 공간으로 사영
  2. Cover Image: 렌즈 공간에 overlapping bins (구간) 정의
  3. Run Clustering: 각 bin 내에서 원본 데이터 포인트 클러스터링
  4. Build Graph: 클러스터마다 노드 생성, 공통 데이터 포인트가 있으면 엣지 연결

Quick Start

Installation

# Basic installation
pip install tda-mapper
 
# Installation with interactive app dependencies
pip install tda-mapper[app]

Minimal Usage Example

import matplotlib.pyplot as plt
from sklearn.datasets import make_circles
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
 
# 1. Generate dataset
X, labels = make_circles(n_samples=5000, noise=0.05, factor=0.3, random_state=42)
 
# 2. Apply PCA as lens
y = PCA(2, random_state=42).fit_transform(X)
 
# 3. Mapper pipeline
cover = CubicalCover(n_intervals=10, overlap_frac=0.3)
clust = DBSCAN()
graph = MapperAlgorithm(cover, clust).fit_transform(X, y)
 
# 4. Visualize
fig = MapperPlot(graph, dim=2, seed=42, iterations=60).plot_plotly(colors=labels)
fig.show()

Interactive Exploration

라이브 데모: tda-mapper-app.up.railway.app

로컬 실행:

tda-mapper-app

Citations

Sources