Skip to content

Commit 1cd1f45

Browse files
authored
Merge pull request #20 from lucasimi/develop
Develop
2 parents c83ca1c + 30cd59c commit 1cd1f45

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

README.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,19 +12,19 @@ Here we'll give just a brief description of the core ideas around the mapper, bu
1212

1313
1. Take any *lens* you want. A lens is just a continuous map $f \colon X \to Y$, where $Y$ is any parameter space, usually having dimension lower than $X$. You can think of $f$ as a set of KPIs, or features of particular interest for the domain of study. Some common choices for $f$ are *statistics* (of any order), *projections*, *entropy*, *density*, *eccentricity*, and so forth.
1414

15-
![Step 1](https://github.com/lucasimi/tda-mapper-python/resources/mapper_1.png)
15+
![Step 1](https://raw.githubusercontent.com/lucasimi/tda-mapper-python/main/resources/mapper_1.png)
1616

1717
2. Build an *open cover* for $f(X)$. An open cover is a collection of open sets (like open balls, or open intervals) whose union makes the whole image $f(X)$, and can possibly intersect.
1818

19-
![Step 2](https://github.com/lucasimi/tda-mapper-python/resources/mapper_2.png)
19+
![Step 2](https://raw.githubusercontent.com/lucasimi/tda-mapper-python/main/resources/mapper_2.png)
2020

2121
3. For each element $U$ of the open cover of $f(X)$, let $f^{-1}(U)$ be the preimage of $U$ under $f$. Then the collection of all the $f^{-1}(U)$'s makes an open cover of $X$. At this point, split every preimage $f^{-1}(U)$ into clusters, by running any chosen *clustering* algorithm, and keep track of all the local clusters obtained. All these local clusters together make a *refined open cover* for $X$.
2222

23-
![Step 3](https://github.com/lucasimi/tda-mapper-python/resources/mapper_3.png)
23+
![Step 3](https://raw.githubusercontent.com/lucasimi/tda-mapper-python/main/resources/mapper_3.png)
2424

2525
4. Build the mapper graph $G$ by taking a node for each local cluster, and by drawing an edge between two nodes whenever their corresponding local clusters intersect.
2626

27-
![Step 4](https://github.com/lucasimi/tda-mapper-python/resources/mapper_4.png)
27+
![Step 4](https://raw.githubusercontent.com/lucasimi/tda-mapper-python/main/resources/mapper_4.png)
2828

2929
N.B.: The choice of the lens $f$ has a deep practical impact on the mapper graph. Theoretically, if clusters were able to perfectly identify connected components (and if they were "reasonably well behaved"), chosing any $f$ would give the same mapper graph (see the [Nerve Theorem](https://en.wikipedia.org/wiki/Nerve_complex#Nerve_theorems) for a more precise statement). In this case, there would be no need for a tool like the mapper, since clustering algorithms would provide a complete tool to understand the shape of data. Unfortunately, clustering algorithms are not that good. Think for example about the case of $f$ being a constant function: in this case computing the mapper graph would be equivalent to performing clustering on the whole dataset. For this reason a good choice for $f$ would be any continuous map which is somewhat *sensible* to data: the more sublevel sets are apart, the higher the chance of a good local clustering.
3030

@@ -64,7 +64,7 @@ fig1, ax = plt.subplots(1, 1, figsize=(6, 6))
6464
colored.plot_static(title='class', ax=ax)
6565
```
6666

67-
![The mapper graph of the iris dataset](https://github.com/lucasimi/tda-mapper-python/resources/iris.png)
67+
![The mapper graph of the iris dataset](https://raw.githubusercontent.com/lucasimi/tda-mapper-python/main/resources/iris.png)
6868

6969
As you can see from the plot, we can identify two major connected components, one which corresponds precisely to a single class, and the other which is shared by the other two classes.
7070

@@ -96,11 +96,11 @@ fig = mapper_plot.with_colors(colors=y, cmap='jet', agg=np.nanmedian).plot_inter
9696
fig.show(config={'scrollZoom': True})
9797
```
9898

99-
![The mapper graph of the digits dataset](https://github.com/lucasimi/tda-mapper-python/resources/digits.png)
99+
![The mapper graph of the digits dataset](https://raw.githubusercontent.com/lucasimi/tda-mapper-python/main/resources/digits.png)
100100

101101
As you can see the mapper graph shows interesting patterns. Note that the shape of the graph is obtained by looking only at the 8x8 pictures, discarding any information about the actual label (the digit). You can see that those local clusters which share the same labels are located in the same area of the graph. This tells you (as you would expect) that the labelling is *compatible with the shape of data*.
102102

103-
![Digits 4 and 7](https://github.com/lucasimi/tda-mapper-python/resources/digits_4_7.png)
103+
![Digits 4 and 7](https://raw.githubusercontent.com/lucasimi/tda-mapper-python/main/resources/digits_4_7.png)
104104

105105
Moreover, by zooming in, you can see that some clusters are located next to others. For example in the picture you can see the details of digits '4' (cyan) and '7' (red) being located one next to the other.
106106

0 commit comments

Comments
 (0)