Manifold Topology Divergence: a Framework for Comparing Data Manifolds

Abstract:
We develop a framework for comparing data manifolds, aimed, in particular, towards the evaluation of deep generative models. We describe a novel tool, Cross-Barcode(P,Q), that, given a pair of distributions in a high-dimensional space, tracks multiscale topology spacial discrepancies between manifolds on which the distributions are concentrated. Based on the Cross-Barcode, we introduce the Manifold Topology Divergence score (MTop-Divergence) and apply it to assess the performance of deep generative models in various domains: images, 3D-shapes, time-series, and on different datasets: MNIST, Fashion MNIST, SVHN, CIFAR10, FFHQ, chest X-ray images, market stock data, ShapeNet. We demonstrate that the MTop-Divergence accurately detects various degrees of mode-dropping, intramode collapse, mode invention, and image disturbance. Our algorithm scales well (essentially linearly) with the increase of the dimension of the ambient highdimensional space. It is one of the first TDA-based practical methodologies that can be applied universally to datasets of different sizes and dimensions, including the ones on which the most recent GANs in the visual domain are trained. The proposed method is domain agnostic and does not rely on pre-trained networks.

heading: 1 Introduction
text: Geometric perspective in working with data distributions has been pervasive in machine learning [5, 8, 12, 10, 23, 20]. Reconstruction of the data from observing only a subset of its points has made a significant step forward since the invention of Generative Adversarial Networks (GANs) [13].
35th Conference on Neural Information Processing Systems (NeurIPS 2021).
Despite the exceptional success that deep generative models achieved, there still exists a longstanding challenge of good assessment of the generated samples quality and diversity [7].
For images, the Fréchet Inception Distance (FID) [16] is the most popular GAN evaluation measure. However, FID is limited only to 2D images since it relies on pre-trained on ImageNet “Inception” network. FID unrealistically approximates point clouds by Gaussians in embedding space; also, FID is biased [6]. Surprisingly, FID can’t be applied to compare adversarial and non-adversarial generative models since it is overly pessimistic to the latter ones [28].
The evaluation of generative models is about comparing two point clouds: the true data cloud Pdata and the model (generated) cloud Qmodel. In view of the commonly assumed Manifold Hypothesis [5, 12], we develop a topology-based measure for comparing two manifolds: the true data manifold Mdata and the model manifoldMmodel, by analysing samples Pdata ⊂Mdata andQmodel ⊂Mmodel. Contribution. In this work, we make the following contributions:
1. We introduce a new tool: Cross-Barcode(P,Q). For a pair of point clouds P and Q, the Cross-Barcode(P,Q) records the differences in multiscale topology between two manifolds approximated by the point clouds; 2. We propose a new measure for comparing two data manifolds approximated by point clouds: Manifold Topology Divergence (MTop-Div); 3. We apply the MTop-Div to evaluate performance of GANs in various domains: 2D images, 3D shapes, time-series. We show that the MTop-Div correlates well with domain-specific measures and can be used for model selection. Also it provides insights about evolution of generated data manifold during training; 4. We have compared the MTop-Div against 7 established evaluation methods: FID, discriminative score, MMD, JSD, 1-coverage, IMD and Geometry score and found that MTop-Div is able to capture subtle differences in data geometry; 5. We have essentially overcame the known TDA scalability issues and in particular have carried out the MTop-Div calculations on most recent datasets such as FFHQ, with dimensions D up to 107.
The source code is available at https://github.com/IlyaTrofimov/MTopDiv.
Related work. GANs try to recover the true data distribution via a min-max game where two players, typically represented by deep neural networks, called Discriminator and Generator, compete by optimizing the common objective. Training curves are not informative since generator and discriminator counter each other, thus, the loss values are often meaningless. Several other measures were introduced to estimate the quality of GANs. However, there is no consensus which of them best captures strengths and limitations of the models and can be used for the fair model selection. The likelihood in Parzen window works poorly in high-dimensional spaces and does not correlate with the visual quality of generated samples [30]. The Inception Score (IS) [29] measures both the discriminability and diversity of generated samples. It relies on the pre-trained Inception network and is limited to 2D images domain. While IS correlates with visual image quality, it ignores the true data distribution, doesn’t detect mode dropping and is sensitive to image resolution. The Fréchet Inception Distance (FID) [16] is a distance between two multivariate Gaussians. These Gaussians approximate the features of generated and true data extracted from the last hidden layer of the pretrained Inception network. Similar variant is KID [6] which computes MMD distance between two distributions of features. The work [14] proposed to use the Duality Gap, a notion from the game theory, as a domain agnostic measure for GAN evaluation. Another variant of a measure inspired by game theory was proposed in [27]. Conventional precision and recall measures can be also used [22, 21]. Accurate calculation of precision and recall is limited to simple datasets from low-dimensional manifolds. The Geometry Score (GScore) [19] is the L2-distance between mean Relative Living Times (RLT) of topological features calculated for the model distribution and the true data distribution. The GScore is domain agnostic, does not involve auxiliary pretrained networks and is not limited to 2D images. However, GScore is not sensitive even to some simple transformations - like constant shift, dilation, or reflection (see our Fig. 2, 4). The barcodes in GScore are calculated approximately, based only on the approximate witness complexes on 64 landmark points sampled from each distribution. That’s why the procedure is stochastic and should be repeated several thousand times for averaging. Thus, the calculation of GScore can be prohibitively long for large datasets. We also refer reader to the comprehensive survey [7].

heading: 2 Cross-Barcode and Manifold Topology Divergence

heading: 2.1 Multiscale simplicial approximation of manifolds
text: According to the well-known Manifold Hypothesis [12] the support of the data distribution Pdata is often concentrated on a low-dimensional manifold Mdata. We construct a framework for comparing numerically such distribution Pdata with a similar distribution Qmodel concentrated on a manifold Mmodel. Such distribution Qmodel is produced, for example, by a generative deep neural network in one of applications’ scenarios. The immediate difficulty here is that the manifold Mdata is unknown and is described only through discrete sets of samples from the distribution Pdata. One standard approach to resolve this difficulty is to approximate the manifold Mdata by simplices with vertices given by the sampled points. The simplices approximating the manifold are picked based on proximity information given by the pairwise distances between sampled points [5, 25]. The standard approach is to fix a threshold r > 0 and to take the simplices whose edges do not exceed the threshold r. The choice of threshold is essential here since if it is too small, then only the initial points, i.e., separated from each other 0-dimensional simplices, are allowed. And if the threshold is too large, then all possible simplices with sampled points as vertices are included and their union is simply the big blob representing the convex hull of the sampled points. Instead of trying to guess the right value of the threshold, the standard recent approach is to study all thresholds at once. This can be achieved thanks to the mathematical tool, called barcode [2, 10], that quantifies the evolution of topological features over multiple scales. For each value of r the barcode describes the topology, namely the numbers of holes or voids of different dimensions, of the union of all simplices included up to the threshold r.

heading: 2.2 Measuring the differences in simplicial approximation of two manifolds
text: However, to estimate numerically the degree of similarity between the manifolds Mmodel,Mdata ⊂ RD, it is important not just to know the numbers of topological features across different scales for simplicial complexes approximating Mmodel,Mdata , but to be able to verify that the similar topological features are located at similar places and appear at similar scales.
Our method measures the differences in the simplicial approximation of the two manifolds, represented by samples P and Q, by constructing sets of simplices, describing discrepancies between the two manifolds. To construct these sets of simplices we take the edges connecting P−points with Q−points, and also P−points between them, ordered by their length, and start adding these edges one by one, beginning from the smallest edge and gradually increasing the threshold, see Figure 1. We add also the triangles and k−simplices at the threshold when all their edges have been added. It is assumed that all edges between Q−points were already in the initial set. We track in this process the births and the deaths of topological features, where the topological features are allowed
here to have boundaries on any simplices formed by Q−points. The longer the lifespan of the topological feature across the change of threshold the bigger the described by this feature discrepancy between the two manifolds.
Homology is a tool that permits to single out topological features that are similar, and to decompose any topological feature into a sum of basic topological features. More specifically, in our case, a k−cycle is a collection of k−simplices formed by P− and Q− points, such that their boundaries cancel each other, perhaps except for the boundary simplices formed only by Q−points. For example, a cycle of dimension k = 1 corresponds to a path connecting a pair of Q−points and consisting of edges passing through a set of P−points. A cycle which is a boundary of a set of (k + 1)−simplices is considered trivial. Two cycles are topologically equivalent if they differ by a boundary, and by collection of simplices formed only by Q−points. A union of cycles is again a cycle. Each cycle can be represented by a vector in the vector space where each simplex corresponds to a generator. In practice, the vector space over {0, 1} is used most often. The union of cycles corresponds to the sum of vectors. The homology vector space Hk is defined as the factor of the vector space of all k−cycles
modulo the vector space of boundaries and cycles consisting of simplices formed only by Q−points. A set of vectors forming a basis in this factor-space corresponds to a set of basic topological features, so that any other topological feature is equivalent to a sum of some basic features.
The homology are also defined for manifolds and for arbitrary topological spaces. This definition is technical and we have to omit it due to limited space, and to refer to e.g. [15, 24] for details. The relevant properties for us are the following. For each topological space X the vector spaces Hk(X), k = 0, 1 . . . , are defined. The dimension of the vector space Hk equals to the number of independent k−dimensional topological features (holes,voids etc). An inclusion Y ⊂ X induces a natural map Hk(Y )→ Hk(X) In terms of homology, we would like to verify that not just the dimensions of homology groups H∗(Mmodel) and H∗(Mdata) are the same but that more importantly the natural maps:
ϕr : H∗(Mmodel ∩Mdata)→ H∗(Mmodel) (1) ϕp : H∗(Mmodel ∩Mdata)→ H∗(Mdata) (2)
induced by the embeddings are as close as possible to isomorphisms. The homology of a pair is the tool that measures how far such maps are from isomorphisms. Given a pair of topological spaces Y ⊂ X , the homology of a pair H∗(X,Y ) counts the number of independent topological features in X that cannot be deformed to a topological feauture in Y plus independent topological features in Y that, after the embedding to X , become deformable to a point. An equivalent description, the homology of a pair H∗(X,Y ) counts the number of independent topological features in the factor-space X/Y , where all points of Y are contracted to a single point. The important fact for us is that the map, induced by the embedding, H∗(Y )→ H∗(X) is an isomorphism if and only if the homology of the pair H∗(X,Y ) are trivial. Moreover the embedding of simple simplicial complexes Y ⊂ X is an equivalence in homotopy category, if and only if the homology of the pair H∗(X,Y ) are trivial [33].
To define the counterpart of this construction for manifolds represented by point clouds, we employ the following strategy. Firstly, we replace the pair (Mmodel∩Mdata) ⊂Mmodel by the equivalent pair Mmodel ⊂ (Mdata ∪Mmodel) with the same factor-space. Then, we represent (Mdata ∪Mmodel) by the union of point clouds P∪Q, where the point clouds P ,Q are sampled from the distributionsPdata, Qmodel. Our principal claim here is that taking topologically the quotient of (Mdata ∪Mmodel) by Mmodel is equivalent in the framework of multiscale analysis of topological features to the following operation on the matrix mP∪Q of pairwise distances of the cloud P ∪Q: we set to zero all pairwise distances within the subcloud Q ⊂ (P ∪Q).

heading: 2.3 Cross-Barcode (P,Q)
text: Let P = {pi}, Q = {qj}, pi, qj ∈ RD are two point clouds sampled from two distributions P , Q. To define Cross-Barcode(P,Q) we construct first the following filtered simplicial complex. Let (ΓP∪Q,m(P∪Q)/Q) be the weighted graph with the distance-like weights on edges defined as the complete graph on the union of point clouds P ∪Q with the distance matrix given by the pairwise distance in RD for the pairs of points (pi, pj) or (pi, qj) and with all pairwise distances within the cloud Q that we set to zero. Our filtered simplicial complex is the Vietoris-Rips complex of (ΓP∪Q,m(P∪Q)/Q).
Recall that given such a graph Γ with matrix m of pairwise distances between vertices and a parameter α > 0, the Vietoris-Rips complex Rα(Γ,m) is the abstract simplicial complex with simplices that correspond to the non-empty subsets of vertices of Γ whose pairwise distances are less than α as measured by m. Increasing parameter α adds more simplices and this gives a nested family of collections of simplices know as filtered simplicial complex. Recall that a simplicial complex is described by a set of vertices V = {v1, . . . , vN}, and a collection of k−simplices S, i.e. (k + 1)−elements subsets of the set of vertices V , k ≥ 0. The set of simplices S should satisfy the condition that for each simplex s ∈ S all the (k − 1)-simplices obtained by the deletion of a vertex from the subset of vertices of s belong also to S. The filtered simplicial complexes is the family of simplicial complexes Sα with nested collections of simplices: for α1 < α2 all simplices of Sα1 are also in Sα2 .
At the initial moment, α = 0, the simplicial complex Rα(ΓP∪Q,m(P∪Q)/Q) has trivial homology Hk for all k > 0 since it contains all simplices formed by Q−points. The dimension of the 0−th
homology equals at α = 0 to the number of P−points, since no edge between them or between a P−point and a Q−point is added at the beginning. As we increase α, some cycles, holes or voids appear in our complex Rα. Then, some combinations of these cycles disappear. The persistent homology principal theorem [2, 37] implies that it is possible to choose the set of generators in the homology of filtered complexes Hk(Rα) across all the scales α such that each generator appears at its specific "birth" time and disappears at its specific "death" time. These sets of “birth" and “deaths" of topological features in Rα are registered in Barcode of the filtered complex.
Definition. The Cross-Barcodei(P,Q) is the set of intervals recording the “births" and “deaths" times of i−dimensional topological features in the filtered simplicial complex Rα(ΓP∪Q,m(P∪Q)/Q).
Examples of Cross-Barcodei(P,Q) are shown on Fig. 2, 11, 14, 17, 18. Topological features with longer “lifespan" are considered essential. The topological features with “birth"=“death" are trivial by definition and do not appear in Cross-Barcode∗(P,Q).

heading: 2.4 Basic properties of Cross-Barcode∗(P,Q)
text: Proposition 1. Here is a list of basic properties of Cross-Barcode∗(P,Q):
• if the two clouds coincide then Cross-Barcode∗(P, P ) = ∅; • for Q = ∅, Cross-Barcode∗(P,∅) = Barcode∗(P ), the barcode of the single point cloud P itself; • the norm of Cross-Barcodei(P,Q), i ≥ 0, is bounded from above by the Hausdorff distance
‖Cross-Barcodei (P,Q)‖B ≤ dH(P,Q). (3)
The proof is given in appendix.

heading: 2.5 The Manifold Topology Divergence (MTop-Div)
text: The bound from eq.(3) and the equality Cross-Barcode∗(P, P ) = ∅ imply that the closeness of Cross-Barcode∗(P,Q) to the empty set is a natural measure of discrepancy between P and Q . Each Cross-Barcodei(P,Q) is a list of intervals describing the persistent homology Hi. To measure the closeness to the empty set, one can use segments’ statistics: sum of lengths, sum of squared lengths, number of segments, the maximal length (Hi max) or specific quantile. We assume that various characteristics of different Hi could be useful in various cases, but the cross-barcodes for H0 and H1 can be calculated relatively fast.
Our MTop-Divergence(P,Q) is based on the sum of lengths of segments in Cross-Barcode1(P,Q), see section 2.6 for details. The sum of lengths of segments in Cross-Barcode1(P,Q) has an interesting interpretation via the Earth Mover’s Distance. Namely, it is easy to prove (see Appendix B.2) that EMDistance between the Relative Living Time histogram for Cross-Barcode1(P,Q) and the histogram of the empty barcode, multiplied by the parameter αmax from the definition of RLT, see e.g. [19], coincides with the sum of lengths of segments in H1. This ensures the standard good stability properties of this quantity.
Our metrics can be applied in two settings: to a pair of distributions Pdata, Qmodel, in which case we denote our score MTop-Div(D,M), and to a pair of distributions Qmodel, Pdata, in which case our score is denoted MTop-Div(M,D). These two variants of the Cross-Barcode, and of the MTopDivergence are related to the concepts of precision and recall. These two variants can be analyzed separately or combined together, e.g. averaged.

heading: 2.6 Algorithm
text: To calculate the score that evaluates the similitude between two distributions, we employ the following algorithm. First, we compute Cross-Barcode1(P,Q) on point clouds P,Q of sizes bP , bQ sampled from the two distributions P , Q. For this we calculate the matrices mP , mP,Q of pairwise distances within the cloud P and between clouds P and Q. Then the algorithm constructs the Vietoris-Rips filtered simplicial complex from the matrix m(P∪Q)/Q which is the matrix of pairwise distances in P ∪Q with the pairs of points from cloud Q block replaced by zeroes and with other blocks given by mP , mP,Q. Next step is to calculate the barcode of the constructed filtered simplicial complex. This step and the previous step constructing the filtered complex from the matrix m(P∪Q)/Q can
Algorithm 1 Cross-Barcodei(P,Q)
Input: m[P, P ], m[P,Q] : matrices of pairwise distances within point cloud P , and between point clouds P and Q Require: VR(M): function computing filtered complex from pairwise distances matrix M Require: B(C, i): function computing persistence intervals of filtered complex C in dimension i bQ ← number of columns in matrix m[P,Q] m[Q,Q]← zeroes(bQ, bQ)
M ← ( m[P, P ] m[P,Q] m[P,Q] m[Q,Q] ) Cross-Barcodei ← B(VR(M), i)
Return: list of intervals Cross-Barcodei(P,Q) representing "births" and "deaths" of topological discrepancies
Algorithm 2 MTop-Divergence(P,Q), see section 2.6 for details, default suggested values: bP = 1000, bQ = 10000, n = 100
Input: XP , XQ: NP ×D, NQ ×D arrays representing datasets for j = 1 to n do Pj ← random choice(XP ,bP ) Qj ← random choice(XQ,bQ) Bj ← list of intervals CrossBarcode1(Pj , Qj) calculated by Algorithm1 mtdj ← sum of lengths of all intervals in Bj
end for MTop-Divergence(P,Q)← mean(mtd)
Return: number MTop-Divergence(P,Q) representing discrepancy between the distributions P,Q
be done using one of the fast scripts1, some of them are optimized for GPU acceleration, see e.g. [35, 4]. The calculation of barcode from the filtered complex is based on the persistence algorithm bringing the filtered complex to its "canonical form" ([2]). Next, sum of lengths or one of other numerical characteristcs of Cross-Barcode1(P,Q) is computed. Then this computation is run a sufficient number of times to obtain the mean value of the picked characteristic. In our experiments we have found that for common datasets the number of times from 10 to 100 is generally sufficient. Our method is summarized in the Algorithms 1 and 2.
Complexity. The Algorithm 1 requires computation of the two matrices of pairwise distances m[P, P ], m[P,Q] for a pair of samples P ∈ RbP×D, Q ∈ RbQ×D involving O(b2PD) and O(bPbQD) operations. After that, the complexity of the computation of barcode does not depend on the dimension D of the data. Generally the persistence algorithm is at worst cubic in the number of simplices involved. In practice, the boundary matrix is sparse in our case and thanks also to the GPU optimization, the computation of cross-barcode takes similar time as in the previous step on datasets of big dimensionality. Since only the discrepancies in manifold topology are calculated, the results are quite robust and a relatively low number of iterations is needed to obtain accurate results. Since the algorithm scales linearly with D it can be applied to the most recent datasets with D up to 107. For example, for D = 3.15× 106, and batch sizes bP = 103, bQ = 104, on NVIDIA TITAN RTX the time for GPU accelerated calculation of pairwise distances was 15 seconds, and GPU-accelerated calculation of Cross-Barcode1(P,Q) took 30 seconds.

heading: 3 Experiments
text: We examine the ability of MTop-Div to measure quality of generative models trained on various datasets. Firstly, we illustrate the behaviour of MTop-Div on simple synthetic datasets (rings (Fig.2), disks (Fig. 13)). Secondly, we show that MTop-Div is superior to the GScore, another topology-based GAN quality measure. We carry out experiments with a mixture of Gaussians, MNIST, CIFAR10, X-ray images, FFHQ. The performance of MTop-Div is on par with FID. For images, MTop-Div is always calculated in pixel space without utilizing pre-trained networks. Thirdly, we apply MTop-Div to GANs from non-image domains: 3D shapes and time-series, where FID is not applicable. We show that MTop-Div agrees with domain-specific measures, such as JSD, MMD, Coverage, discriminative score, but MTop-Div better captures evolution of generated data manifold during training 2.

heading: 3.1 Simple synthetic datasets in 2D
text: As illustrated on Fig. 2 the GScore does not respond to shifts of the distributions’ relative position.
1Persistent Homology Computation (wiki) 2we additionally calculated IMD [31] for the pairs of point clouds from our experiments, see Appendix E.
3.2 Mode-Droping on Gaussians
One of common tasks to assess GAN’s performance is measuring it’s ability to uncover the variety of modes in the data distribution. A common benchmark for this problem is a mixture of Gaussians, see Fig. 3. We trained two generators with very different performance: original GAN, which managed to capture all 5 modes of the distribution and WGAN-GP, which have only covered poorly two. However, the Geometry score is not sensitive to such a difference since two point clouds have the same RLT histogram. While the MTop-Div is sensitive to such a difference.
3.3 Digit flipping on MNIST vs Geometry Score = 0.0
MTop-Div = 6154.0
Figure 4: Two point clouds:“5”s from MNIST vs. vertically flipped “5”s from MNIST (resembling rather “2”s). The two clouds are indistinguishable for Geometry Score, while the MTop-Div is sensitive to such flip as it depends on the positions of clouds with respect to each other.
Figure 4 shows an experiment with MNIST dataset. We compare two point clouds: “5”s vs. vertically flipped “5”s (resembling rather “2”s). These two clouds are indistinguishable for Geometry Score, while the MTop-Div is sensitive to such flip since it depends on the relative position of the two clouds.

heading: 3.4 Synthetic modifications of CIFAR10
text: We evaluate the proposed MTop-Div(D,M) using a benchmark with the controllable disturbance level. We take CIFAR10 and apply the following modifications. Firstly, we emulate common issues in GAN: mode drop, mode invention and mode collapse by doing class drop, class addition and intra-class collapse (removal of objects within a class). Secondly, we apply two disturbance types: erasure of a random rectangle and a Gaussian noise. As ‘real’ images we use the test set from CIFAR10, as ‘generated’ images - a subsample of the train set with applied modifications. The size of the later always equals the test set size. Figure 5 shows the results. Ideally, the quality measure should monotonically increase with the disturbance level. We conclude that Geometry Score is monotone only for ‘mode invention’ and ‘intra-mode collapse’ while MTop-Div(D,M) is almost monotone for all the cases. The average Kendall-tau rank correlation between MTop-Div(D,M) and disturbance level is 0.89, while for Geometry Score the rank correlation is only 0.36. FID performs well on this
benchmark, not shown on Figure 5 for ease of perception. Additionally, we calculated MTop-Div for higher order Cross-Barcodes, see Appendix D.

heading: 3.5 GAN model selection
text: We trained WGAN and WGAN-GP on various datasets: CIFAR10, SVHN, MNIST, FashionMNIST and evaluated their quality, see Table 1. Experimental data show that the ranking between WGAN and WGAN-GP is consistent for FID and MTop-Div.

heading: 3.6 Experiments with StyleGAN
text: We evaluated the performance of StyleGAN [17] and StyleGAN2 [18] generators trained on the FFHQ dataset3. We generated 20 × 103 samples with two truncation levels: ψ = 0.7, 1.0 and compared them with 20× 103 samples from FFHQ. The truncation trick is known to improve average image quality but decrease image variance. Figure 7 show the results (see also Table 2 in Appendix for more data). Thus, the ranking via MTop-Div(M, D) is consistent with FID. We also tried to calculate Geometry Score but found that it takes a prohibitively long time.

heading: 3.7 Chest X-rays generation for COVID-19 detection
text: Waheen et al. [32] described how to apply GANs to improve COVID-19 detection from chest X-ray images. Following [32], we trained an ACGAN [26] on a dataset consisting of chest X-rays of COVID-19 positive and healthy patients 4. Next, we studied the training process of ACGAN. Every 10’th epoch we evaluated the performance of ACGAN by comparing real and generated COVID-19 positive chest X-ray images. That is, we calculated FID, MTop-Div(D,M) and a baseline measure -
3https://github.com/NVlabs/ffhq-dataset (CC-BY 2.0 License) 4We used the ACGAN implementation https://github.com/clvrai/ACGAN-PyTorch, (MIT License) and chest X-ray data was from https://www.kaggle.com/tawsifurrahman/ covid19-radiography-database (Kaggle Data License)
discriminative score 5 of a CNN trained to distinguish real vs. generated data. The MTop-Div agrees with FID and the discriminative score. PCA projections show that generated data approximates real data well. Figure 20 in Appendix presents real and generated images.
Additionally, we compared real COVID-positive and COVID-negative chest X-ray images, see horizontal dashed lines at Fig. 6. Counterintuitively, for FID real COVID-positive images are closer to real COVID-negative ones than to generated COVID-positive images; probably because FID is overly sensitive to textures. At the same time, evaluation by MTop-Div is consistent.

heading: 3.8 3D shapes generation
text: We use the proposed MTop-Div score to analyze the training process of the GAN applied to 3D shapes, represented by 3D point clouds [1]. For training, we used 6778 objects of the “chair” class from ShapeNet [9]. We trained GAN for 1000 epochs and tracked the following standard quality measures: Minimum Matching Distance (MMD), Coverage, and Jensen-Shannon Divergence (JSD) between marginal distributions. To understand the training process in more details, we computed PCA decomposition of real and generated objects (Fig. 8, bottom). For computing PCA, each object (3D point cloud) was represented by a vector of point frequencies attached to the 3-dimensional 283 grid. Figure 8, top, shows that conventional metrics (MMD, JSD, Coverage) doesn’t represent the training process adequately. While these measures steadily improve, the set of generated objects dramatically changes. At epoch 50, the set of generated objects (green) “explodes” and becomes much more diverse, covering a much larger space than real objects (red). Conventional quality measures (MMD, JSD, Coverage) ignore this shift while MTop-Div has a peak at this point. Next, we evaluated the final quality of GAN by training a classifier to distinguish real and generated object. A simple MLP with 3 hidden layers showed accuracy 98%, indicating that the GAN poorly approximates the manifold of real objects. This result is consistent with MTop-Div: at epoch 1000 it is even larger than at epoch 1.

heading: 3.9 Time series generation
text: Next, we analyze training dynamics of TimeGAN [34] tailored to multivariate time-series generation. We followed the experimental protocol from [34] and used the daily historical market stocks data
5Discriminative score equals accuracy minus 0.5. MTop-Div better correlates with the discriminative score than FID: 0.75 vs. 0.66.
from 2004 to 2019, including as features the volume, high, low, opening, closing, and adjusted closing prices. The baseline evaluation measure is calculated via a classifer (RNN) trained to distinguish real and generated time-series. Particularly, the discriminative score equals to the accuracy of such a classifer minus 0.5. Fig. 9, top, shows the results. We conclude that the behaviour of MTop-Div is consistent with the discriminative score: both of them decrease during training. To illustrate training in more details we did PCA projections of real and generated time-series by flattening the time dimension (Fig. 9, bottom). At 2000-th epoch, the point clouds of real (red) and generated (green) time-series became close, which is captured by a drop of MTop-Div score. At the same time, discriminative score is not sensitive enough to this phenomena.

heading: 4 Conclusions
text: We have proposed a tool, Cross-Barcode∗(P,Q), which records multiscale topology discrepancies between two data manifolds approximated by point clouds. Based on the Cross-Barcode∗(P,Q), we have introduced the Manifold Topology Divergence and have applied it to evaluate the performance of GANs in various domains: 2D images, 3D shapes, time-series. We have shown that the MTop-Div correlates well with domain-specific measures and can be used for model selection. Also, it provides insights about the evolution of generated data manifold during training and can be used for early stopping. The MTop-Div score is domain agnostic and does not rely on pre-trained networks. We have compared the MTop-Div against 7 established evaluation methods: FID, discriminative score, MMD, JSD, 1-coverage, IMD, and Geometry score and found that MTop-Div outperforms many of them and captures well subtle differences in data manifolds. Our methodology permits to overcome the known TDA scalability issues and to carry out the MTop-Div calculations on the most recent datasets such as FFHQ, with the size of up to 105 and the dimension of up to 107.

heading: Acknowledgements
text: Evgeny Burnaev acknowledges the support of the Ministry of Science and Higher Education grant No. 075-10-2021-068. Authors are thankful to Alexei Artemov for help with the 3D shapes experiment.

Review summaries:
The authors propose a method to compare two data manifolds based on topology. A persistent diagram is constructed using both sets of samples (cross-barcode), and the proposed metric is computed as the average length of segments in the cross-barcode. The efficiency of the method is demonstrated in several experimental settings.

The manuscript introduces the cross-barcode between two point clouds, and uses it to construct the manifold topology divergence (MTD). It is proposed that this can be used for performance evaluation of GANs. A selection of experiments are run to show that the MTD is robust where other evaluation metrics fail. 

This work introduces a novel method based on relative persistent homology (because the term of persistent relative homology has been occupied before, referring to completely different concept) for measuring the similarity between manifolds, especially the sample point clouds of the manifolds. The distance uses the bar-code of persistent homology, and the homology groups are relative groups H_k(P,Q). The relative between the cross-bar codes and the Hausdorff distance between the point clouds   is proved in the appendix.  Based on the cross-barcode, the manifold topology divergence score (MTop-Divergence) is introduced and applied to assess generative models in various domains. The MTop-Div can detect mode collapsing , mode invention more effectively.  This is a first TDA-based practical method, and has many merits, scalability, domain agnostic, independence of pre-trained networks.