Topological Autoencoders
Topology constrained representation learning using autoencoders
Created on March 14|Last edited on May 14
Comment
Introduction
Empowered by the manifold hypothesis, encoding high-dimensional data to low-dimensional latent codes has been extensively used in the machine learning community, both in academia and in industry.
Used everywhere from recommendation systems to data compression, the dimensionality reduction has seen trends ranging from simple linear methods like Principal Component Analysis to complicated Deep Neural Embeddings. And since the beginning of the deep learning revolution, AutoEncoders, with their extremely intuitive architecture, have been at the forefront.
But despite their extensive usage, the latent codes (embeddings) of any dimensionality reduction algorithm can only describe a small neighborhood, induced by the manifold hypothesis, around each encoded vector with little to no information about the global structure of the embedded space. Hence it is generally impossible to describe how the representations are positioned relative to every other vector embedded in that space.
This ICML20 work by Michael Moor et.al. from ETH Zurich, studies the novel problem of dimensionality reduction while preserving the high-dimensional topology of the original data (up to homeomorphism).
Paper
Codebase
Let's get into it:
Topology of Latent Spaces
In simple terms, topology is a branch of mathematics devoted for studying shapes up to continuous transformations. One intuitive way of understanding what topology refers to, is through the classic topology joke:

This rises from the fact that a coffee mug can be continuously deformed to form a donut (torus) and vice-versa. Specifically, we mean that the number of holes in the objects do not change.

Formally: two objects are called topologically equivalent if they have equal numbers of d-dimensional holes (holes that can be filled by objects homeomorphic to a d-dimensional sphere), called Betti Numbers denoted by .
Key Takeaway: Betti Numbers serve the purpose of topologically classifying objects. A few common objects, with their Betti Numbers are given below. ( denotes the dimensional betti number.)

Betti Numbers of common objects. (Note: Betti Numbers of torus and mug are the same.)
The primary intuition behind the paper is to enforce a topological regularization on the latent space of AutoEncoders. Hence, it is important to capture the topology of the data manifold from the data samples. Capturing topological descriptors (like Betti Numbers) from point sets is an extremely challenging problem due lack of "connectivity" in high dimensional pointsets. Intuitively, a set of points sampled from some "high-dimensional surface" doesn't encode any information how the surface was originally "connected". Exploring the exponentially large solution space of surfaces (a point can be connected to any other point in the set) is another problem in itself.
Persistent Homology
Let be a set data points where . Building upon the union-ball definition of Topological Spaces, a widely used tool from Computational Algebraic Topology called Persistent Homology, approximates a topological descriptor from geometric point sets.
Comprehensively, -balls (n-dimensional balls, parameterized by their radius ) are "grown" around each sample point , thereby defining a growing neighborhood. Upon intersection of -balls the data points are connected with a -simplex (-dimensional triangle). The connectivity formed fills a k-dimensional hole on the original point set.
For futher reference, this growing set of simplicies (formally, simplicial complex) by intersecting growing -balls is called a VietorisRips Filtration.

Finally the birth and death radiuses and of each hole is tracked. The primary intuition behind this seemingly complicated algorithm, is the holes that "persists" longer (i.e. high ) have higher topological significance. The birth and death radiuses of the holes are plotted onto a chart with values , which is called a Persistence Diagram.

Persistence Diagram of the above Filtration. ( denotes -dimensional hole, i.e., homology)
Persistence Diagrams and Topological Loss
One of the primary contributions of this work is the introduction of a novel loss function, capable of comparing topological descriptors (specifically, persistence diagrams) of the data and latent space, in a stable and differentiable manner. In brief, the authors approximate the inherently discrete persistence diagram calculation, using a differentiable relationship on the pairwise distance matrix.
For a Vietoris--Rips Filtration of a dataset , the persistent homology PH, yields the persistence diagrams and persistence pairings . The persistence diagrams is defined by the tuple of birth and death radiuses of hole. Similarly, the persistence pairings, , is defined by the tuple of "most significant" vertices (vertices of largest simplex which creates / destroyed the hole) for the filtration. Since calculating the persitence diagrams differentiably, at a scale, is still an active area of research, the authors uses the following expression for approximating the persistence diagrams.
where denotes the pairwise distance matrix of data samples or latent space samples .

Training Setup (extracted from paper)
The final training setup uses this persistence diagram approximation, to define a topological regularization metric () as shown below.
where denotes the topological loss term for the encoding procedure, and denotes the topological loss term form decoding procedure. The mathematical definition of these loss terms are defined as follows.
The final loss term is defined as:
Experiments
The experiments are performed on a topological spheres dataset, as shown below.

Orange hypersphere encapsulates the blue hyperspheres (diagram extracted from ICML Oral Presentation).
The dataset contains a high dimensional hypersphere, which "encapsulates" smaller hyperspheres. As shown below, when the latent space samples are plotted for regular autoencoders (Vanilla AE), it can be observed that every spherical component gets seperated from each other, hence loosing the "encapsulating" structure of the high-dimensional hyperpsheres.
However this is not the case for Topologically Regularized AutoEncoder, where the topological structure of the dataset is preserved in the latent space.
Run set
1
Conclusion
Enforcing topological regularization to low-dimensional latent space, allows in building richer latent spaces, equivalent to continuous deformations.
This not only contributes towards more reliable visualization of high-dimensional data manifolds, but also opens up various avenues for studying problems involving generative models, implicit representations, geodesic interpolation, etc. The novelty of this paper also extends in being one of the very few attempts to bridge Computational Algebraic Topology, Topological Data Analysis with main-stream Deep Learning.
With that said, this rise in interest for Topology and Geometry in Deep Learning, would surely give a fresh perspective to various unexplained problems and wonders Deep Learning offers.
Add a comment
Tags: Advanced, Domain Agnostic
Iterate on AI agents and models faster. Try Weights & Biases today.