Skip to content

Commit 5acc594

Browse files
committed
Added docstring for help
1 parent 18715a5 commit 5acc594

2 files changed

Lines changed: 40 additions & 0 deletions

File tree

docs/source/conf.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ def convert_py_to_ipynb():
4646

4747
extensions = [
4848
"sphinx.ext.autodoc",
49+
"sphinx.ext.doctest",
4950
"sphinx.ext.viewcode",
5051
"sphinx_rtd_theme",
5152
"nbsphinx",

src/tdamapper/__init__.py

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
"""
2+
This library provides a Python implementation of the TDA Mapper algorithm,
3+
which is used for topological data analysis (TDA). The TDA Mapper algorithm
4+
is a method for extracting topological features from high-dimensional data
5+
by constructing a simplicial complex that captures the shape of the data.
6+
7+
The `tdamapper` package includes the following main modules:
8+
- `core`: Contains the core implementation of the Mapper algorithm.
9+
- `cover`: Provides classes for creating _open covers_, which are collections of overlapping sets
10+
that cover the data space.
11+
- `learn`: Includes classes compatible with scikit-learn's estimator API based on Mapper. These
12+
classes can be used in scikit-learn pipelines.
13+
- `utils`: Provides utility functions for creating spatial indexes.
14+
- `plot`: Contains functions for visualizing the Mapper graph.
15+
16+
To use the TDA Mapper algorithm, you can follow these steps:
17+
18+
Examples
19+
--------
20+
>>> from sklearn.datasets import make_circles
21+
>>>
22+
>>> import numpy as np
23+
>>> from sklearn.decomposition import PCA
24+
>>> from sklearn.cluster import DBSCAN
25+
>>>
26+
>>> from tdamapper.learn import MapperAlgorithm
27+
>>> from tdamapper.cover import CubicalCover
28+
>>> from tdamapper.plot import MapperPlot
29+
>>>
30+
>>> X, labels = make_circles(n_samples=5000, noise=0.05, factor=0.3, random_state=42)
31+
>>> y = PCA(2, random_state=42).fit_transform(X)
32+
>>>
33+
>>> cover = CubicalCover(n_intervals=10, overlap_frac=0.3)
34+
>>> clust = DBSCAN()
35+
>>> graph = MapperAlgorithm(cover, clust).fit_transform(X, y)
36+
>>>
37+
>>> fig = MapperPlot(graph, dim=2, seed=42, iterations=60).plot_plotly(colors=labels)
38+
>>> fig.show(config={"scrollZoom": True})
39+
"""

0 commit comments

Comments
 (0)