
Mapper Python Implementation
A few posts ago I wrote about the mapper construction by Carlsson-Memoli-Singh and want to follow up on that a little.
I wrote a straightforward implementation of the construction in Python. It can be found here: github.com/mirkoklukas/tda-mapper-py.
Example Usage
from tdamapper.clusterfunctions import VietorisRipsClustering from tdamapper import mapper from tdamapper.referenceMap import create_functional_cover, coordinate_projection import json # Example data set with open("./example/dataset.json") as f: data = json.load(f); data = [ tuple(p) for p in data ] # Gather the mapper input VR = VietorisRipsClustering(epsilon = 0.6) zAxis = coordinate_projection(axis=2, domain=data) funcCover = create_functional_cover(endpoints=range(-12,12), overlap=0.5) # Run the alogrithm result = mapper(VR, zAxis, funcCover)
Below you see a visualization of the mapper result. The graph is colored by the values of zAxis , the projection on the z-axis. The size of the nodes reflects the size of the associated clusters.
The take away should be that there are actually two separate branches growing out of a bigger cluster. You shouldn’t focus too much on the fact that the two branches cross each other. Although it reflects the reality of the situation pretty well, it is rather a bi-product of the fact that I used very simple data set in so few dimensions, and that I was too lazy to reduce the number of the crossing in the graph.
And indeed (what a terrible example it would have been if that was not the case) looking at a 3d plot of the original dataset we see that this reflects the shape pretty well.
Again: it’s the two branches that matter, not the crossings, I chose a misleading example and really should update that in the future.
What other tools would one need in order to supplement MAPPER as part of a full topological data analysis solution?
Like, what did Ayasdi build on top of MAPPER that took it from a hardly used open source library to a successful commercial product?
Hi Brandon,
I haven’t looked into Ayasdi’s product too much, but I think they have a pretty sophisticated user interface. Furthermore you could automatically run tons of instances with predefined filter functions. Maybe have some criteria to automatically sort out good results etc., e.g. a filter that separates a subgroup your interested in from the rest of the data or something of that kind. I primarily view Mapper as a visualization tool.
Best,
Mirko
Have you seen Kepler Mapper?
https://github.com/MLWave/kepler-mapper
It has worked well for me, but is still not iron-clad. I wish there were better, more robust options.
I’m not against commercialization, but the existence of Ayasdi has caused my colleagues (who are not that familiar with topology to begin with) to not take mapper seriously. The lackadaisical name doesn’t help.
Yet, as a visualization tool, it often significantly outperforms other techniques, like t-SNE. And of course, it’s more than just for visualization.
It’s a bit of a shame. But the good news is that mapper has been making headway in genomics and people are working on open source versions.
In due time it may become mainstream.