Visualization of AE's Training on Credit Card Transactions with Persistent Homology
Jeremy Charlier, Francois Petit, Gaston Ormazabal, Radu State, Jean, Hilger

TL;DR
This paper introduces PHom-WAE, a novel topological method using persistent homology to evaluate and improve the data distribution quality of Wasserstein Auto-Encoders, especially on complex real-world credit card transaction data.
Contribution
It proposes a new topological distance measure, the bottleneck distance, for Wasserstein Auto-Encoders to better assess latent space quality compared to traditional methods.
Findings
Persistent homology effectively captures topological features of data manifolds.
PHom-WAE outperforms traditional distance measures on real-world datasets.
The methodology provides a new way to evaluate generative models' data distribution quality.
Abstract
Auto-encoders are among the most popular neural network architecture for dimension reduction. They are composed of two parts: the encoder which maps the model distribution to a latent manifold and the decoder which maps the latent manifold to a reconstructed distribution. However, auto-encoders are known to provoke chaotically scattered data distribution in the latent manifold resulting in an incomplete reconstructed distribution. Current distance measures fail to detect this problem because they are not able to acknowledge the shape of the data manifolds, i.e. their topological features, and the scale at which the manifolds should be analyzed. We propose Persistent Homology for Wasserstein Auto-Encoders, called PHom-WAE, a new methodology to assess and measure the data distribution of a generative model. PHom-WAE minimizes the Wasserstein distance between the true distribution and the…
| PHom-WAE | PHom-VAE | Difference (%) |
| 0.0788 | 0.0878 | 10.25 |
| PHom-WAE | PHom-VAE | Difference (%) |
| 0.0984 | 0.1372 | 28.28 |
Peer Reviews
No public reviews on file for this paper yet. If you reviewed it on a platform where reviews are public (OpenReview, ICLR, NeurIPS, ICML), you can paste yours below so the community can read it here.
Videos
No videos yet. Explain this paper in a talk, walkthrough, or lecture? Add one.
Taxonomy
TopicsTopological and Geometric Data Analysis · Advanced Neuroimaging Techniques and Applications · Cell Image Analysis Techniques
11institutetext: University of Luxembourg, L-1855 Luxembourg, Luxembourg
11email: {name.surname@}@uni.lu 22institutetext: Columbia University, New York NY 10027, USA
22email: {jjc2292,gso7@}@columbia.edu 33institutetext: BCEE, L-1160 Luxembourg, Luxembourg
33email: [email protected]
Visualization of AE’s Training on Credit Card Transactions with Persistent Homology
Jeremy Charlier 1122
Francois Petit 11
Gaston Ormazabal 22
Radu State 11
Jean Hilger 33
Abstract
Auto-encoders are among the most popular neural network architecture for dimension reduction. They are composed of two parts: the encoder which maps the model distribution to a latent manifold and the decoder which maps the latent manifold to a reconstructed distribution. However, auto-encoders are known to provoke chaotically scattered data distribution in the latent manifold resulting in an incomplete reconstructed distribution. Current distance measures fail to detect this problem because they are not able to acknowledge the shape of the data manifolds, i.e. their topological features, and the scale at which the manifolds should be analyzed. We propose Persistent Homology for Wasserstein Auto-Encoders, called PHom-WAE, a new methodology to assess and measure the data distribution of a generative model. PHom-WAE minimizes the Wasserstein distance between the true distribution and the reconstructed distribution and uses persistent homology, the study of the topological features of a space at different spatial resolutions, to compare the nature of the latent manifold and the reconstructed distribution. Our experiments underline the potential of persistent homology for Wasserstein Auto-Encoders in comparison to Variational Auto-Encoders, another type of generative model. The experiments are conducted on a real-world data set particularly challenging for traditional distance measures and auto-encoders. PHom-WAE is the first methodology to propose a topological distance measure, the bottleneck distance, for Wasserstein Auto-Encoders used to compare decoded samples of high quality in the context of credit card transactions.
Keywords:
Barcodes Encoding-Decoding Persistence Diagram.
1 Motivation
Dimension reduction techniques were initially driven by linear algebra with second order matrix decompositions such as the Singular Value Decomposition (SVD) [1] and, ultimately, with tensor decompositions [2, 3], a higher order analogue of the matrix decompositions. Although SVD is fast enough to be applied on large data sets, it is limited to second order because it relies on matrices. While tensors are suitable for third-order experiments and above, the complexity of the decomposition and the time required for the computations become a limitation as soon as the size of the data set grows [4, 5]. Hence, in recent years, several architectures for dimension reductions based on neural networks have been proposed. Dense Auto-Encoders (AE) [6, 7] are one of the most well established approach. More recently, the Variational Auto-Encoders (VAE) presented by Kingma et al. in [8] constitute a well-known approach but they might generate poor target distribution because of the KL divergence.
We recall an AE is a neural network trained to copy its input manifold to its output manifold through a hidden layer. The encoder function sends the input space to the hidden space and the decoder function brings back the hidden space to the input space. As explained in [9], the points of the hidden space are chaotically scattered for most of the encoders, including the popular VAE. Even after proper training, groups of points of various sizes gather and cluster by themselves randomly in the hidden layer. Therefore, some features are missing in the reconstructed distribution . The description of the scattered points is very complex using traditional distance measures, such as the Euclidean distance, because they are not able to acknowledge the shapes of the data manifolds. However, persistent homology is specifically designed to highlight the topological features of the data [10]. Therefore, building upon persistent homology, Wasserstein distance [11] and Wasserstein Auto-Encoders (WAE) [12], our main contribution is to propose qualitative and quantitative ways to evaluate the scattered hidden space and the overall performance of AE.
In this work we describe the persistent homology features of the encoded and decoded model distribution while minimizing the Optimal Transport (OT) function for a squared cost where is the model distribution of the data, and the latent variable model specified by the prior distribution of latent manifold and the generative model of the initial distribution given . The method is highlighted in figure 1. Our contributions are summarized below:
- •
A persistent homology procedure for WAE which we call PHom-WAE to highlight the topological properties of the encoded and decoded distribution of the data for different spatial resolutions. The objective is twofold: a persistent homology description of the encoded latent space , and a persistent homology description of the decoded latent space following the generative model .
- •
A distance measure for persistence diagrams, the bottleneck distance, applied to WAE to compare quantitatively the true and the target distributions on any data set. We measure the shortest distance for which there exists a perfect matching between the points of the two persistence diagrams. A persistence diagram is a stable summary representation of topological features of simplicial complex, a collection of vertices, associated to the data set.
- •
A persistent homology procedure to highlight the scattered latent distribution provoked by Variational Auto-Encoders (VAE) in comparison to WAE on a real-word data set. We use the concepts introduced for PHom-WAE to define PHom-VAE, Persistent Homology for VAE. We highlight the VAE’s hidden layer scattered distribution using persistent homology, confirming the original statement of VAE’s scattered distribution introduced in [13].
- •
Finally, we propose the first application of algebraic topology and WAE on a public data set containing credit card transactions, particularly challenging for traditional distance measures and auto-encoders.
The paper is structured as follows. We discuss related works in section 2. In section 3, we review the WAE formulation using OT derived by Tolstikhin et al. in [12]. By using persistence homology, we are able to compare the topological properties of the distributions and , illustrated in figure 1. We highlight the experimental results in section 4 and we conclude in section 5 by addressing promising directions for future work.
2 Related Work
Literature on Persistence Homology and Topology A major trend in modern data analysis is to consider that the data has a shape, and more precisely, a topological structure. Topological Data Analysis (TDA) is a set of tools relying on computational algebraic topology allowing to obtain precise information about the data structure. Two of the most important techniques are persistence homology and the mapper algorithm [10].
Data sets are usually represented as points cloud of Euclidean spaces. Hence, the shape of a data set depends of the scale at which it is observed. Instead of trying to find an optimal scale, persistence homology, a method of TDA, studies the changes of the topological features (number of connected components, number of holes, …) of a data set depending of the scale. The foundations of persistence homology have been established in the early 2000s in [14], [15], [16] and [17]. They provide a computable algebraic invariant of filtered topological spaces (nested sequences of topological spaces which encode how the scale changes) called persistence module. This module can be decomposed into a family of intervals called persistence diagram or barcodes. This family records how the topology of the space is changing when going through the filtration [18]. The space of barcodes is measurable through the bottleneck distance. Moreover, the space of persistence module is also endowed with a metric and under a mild assumptions these two spaces are isometric [19]. Additionally, the Mapper algorithm first appeared in [20]. It is a visualization algorithm which aims at produce a low dimensional representation of high-dimensional data sets in form of a graph, therefore, capturing the topological features of the points cloud.
Meanwhile, efficient and fast algorithms have emerged to compute persistence homology [15],[17] as well as to construct filtered topological spaces using, for instance, the Vietoris-Rips complex [21]. Therefore, it has already found numerous successful applications. For instance, Nicolau et al. in [22] detected subgroups of cancers with unique mutational profile. In [23], it has been shown that computational topology could be used in medicine, social sciences or sport analysis. More recently, Bendich et al. improved statistical analyses of brain arteries of a population [24] while Xia et al. were capable of extracting molecular topological fingerprints for proteins in biological science [25].
Literature on Auto-Encoders and Optimal Transport A large variety of AE have appeared in the last few years [13]. Although promising results were achieved, most of the solutions did not address the representation of the samples of the encoded and decoded manifolds. As outlined by Bengio et al. in [9], the points in the encoded manifold for the majority of the encoders are chaotically scattered. Therefore, some features are missing in the reconstructed distribution . Thus, sampling data points for the reconstruction with traditional AE is difficult. The added constraint of Variational Auto-Encoder (VAE) in [8] by the mean of a KL divergence, composed of a reconstruction cost and a regularization term, provides a finer solution to generate adversarial data by reducing the impact of the chaotic scattered distribution of .
Concurrently to the emergence of AE, Goodfellow et al. introduced the Generative Adversarial Network (GAN) model in [26] in 2014. Although the GAN did not have an encoder, it consists of two parts, a generator to generate adversarial samples and a discriminator to fit the generated data points to the true data distribution. However, the GAN suffers from a mode collapse between the generator and the discriminator [13]. As a solution, optimal transport [27] was applied to GAN in [28] with the Wasserstein distance, and therefore, introducing Wasserstein GAN (WGAN). By adding a gradient penalty to the Wasserstein distance, Gulrajani et al. in [29] introduced a new training for GANs while avoiding the mode collapse. As described in [30, 31] in the context of unbalanced optimal transport, Tolstikhin et al. applied these concepts to AE in [12]. They proposed to add one extra divergence to the objective minimization function in the context of generative modeling leading to Wasserstein Auto-Encoders (WAE).
In this paper, using persistent homology and the bottleneck distance, we propose qualitative and quantitative ways to evaluate the performance of the compression of AE. We build upon the work of WAE and unbalanced OT with persistent homology. We show that that the barcodes, inherited from the persistence diagrams, are capable of representing the encoded manifold generated by the WAE. Furthermore, we show that the bottleneck distance allows to compare quantitatively the topological features between the samples of the reconstructed distribution and the samples of the true distribution.
3 Proposed Method
Our method computes the persistent homology of both the latent manifold and the reconstructed manifold following the generative model based on the minimization of the optimal transport cost . In the resulting topological problem, the points of the manifolds are transformed to a metric space set for which a Vietoris-Rips simplicial complex filtration is applied (see definition 2). PHom-WAE achieves simultaneously two main goals: it computes the lifespan of the persistent homological features while measuring the bottleneck distance between the persistence diagrams of the WAE’s manifolds.
3.1 Preliminaries and Notations
We follow the notations used by Tolstikhin et al. in [12]. Sets are denoted by calligraphic letters such as , random variables by capital letters , and their values by lower case letters . Probability distributions are denoted by capital letters and their corresponding densities by lower case letters .
3.2 Optimal Transport and Dual Formulation
Following the description of the optimal transport problem [27] and relying on the Kantorovich-Rubinstein duality, the Wasserstein distance is computed as
[TABLE]
where is a metric space, is a set of all joint distributions with marginals and respectively and is the class of all bounded 1-Lipschitz functions on .
3.3 Wasserstein Auto-Encoders
As described in [12], the WAE objective function is expressed such that
[TABLE]
where is any measurable cost function. In our experiments, we use a square cost function for data points . denotes the sending of to for a given map . , and , are any nonparametric set of probabilistic encoders, and decoders respectively.
We use the Maximum Mean Discrepancy (MMD) for the penalty for a positive-definite reproducing kernel
[TABLE]
where is the reproducing kernel Hilbert space of real-valued functions mapping on . For details on the MMD implementation, we refer to [12].
3.4 Vietoris-Rips Complex, Persistence Diagram and Barcodes
We explain the construction of the persistence module associated to a sample of a fixed distribution on a space. First, two manifold distributions are sampled from the WAE’s training. Then, we construct the persistence modules associated to each sample of the points manifolds. We refer to the first subsection of section 2 for pointed reference on persistent homology.
We associate to our points manifold , considered as a finite metric space, a sequence of simplicial complexes. For that aim, we use the Vietoris-Rips complex.
Definition 1 Let be a set of vertices. A simplex is a subset of vertices . A simplicial complex K on V is a collection of simplices , such that . The dimension of is its number of elements minus 1. Simplicial complexes examples are represented in figure 2.
Definition 2 Let be a metric space. The Vietoris-Rips complex at scale associated to , denoted by , is the abstract simplicial complex whose vertex set is , and where is a -simplex if and only if for all .
We obtain an increasing sequence of Vietoris-Rips complex by considering the for an increasing sequence of value of the scale parameter
[TABLE]
Applying the k-th singular homology functor with coefficient in the field [32] to (4), we obtain a sequence of -vector spaces, called the k-th persistence module of
[TABLE]
Definition 3 , the (i,j)-persistent -homology group with coefficient in of denoted is defined to be the image of the homomorphism .
Using the interval decomposition theorem [33] , we extract a finite family of intervals of called persistence diagram. Each interval can be considered as a point in the set . Hence, we obtain a finite subset of the set . This space of finite subsets is endowed with a matching distance called the bottleneck distance and defined as follow
[TABLE]
where , , and the is over all the bijections from to .
Application We illustrate the construction of the barcodes and persistence diagram with the filtration parameter in figure 3, according to the previous definitions. For every data point, the size of the points is continuously and artificially increased using a filtration parameter . The points are, therefore, transformed to geometrical disks as the filtration parameter keeps growing. When two disks intersect, a line is drawn between the two corresponding original data points, creating a connected component defined as 1-simplex, while a barcode is drawn in a separate diagram. The barcodes highlight the birth-death cycles of each homological groups, for the connected components and for the loops. At the end of the filtration procedure, a persistence diagram is drawn to recapitulate the birth-death events observed with the barcodes, as shown in figure 4. The persistence diagram is used to describe the topological properties of the original data points cloud using quantitative measures, such as the bottleneck distance.
3.5 PHom-WAE, Persistent Homology for Wasserstein Auto-Encoder
Bridging the gap between topology and neural networks, PHom-WAE uses a two-steps procedure. First, the minimization problem of WAE is solved for the encoder and the decoder . We use Adam optimizer [34] for the optimization procedure. Then, the samples of the encoded and decoded distributions, and , are mapped to persistence homology to describe their respective manifold.
We highlight the topological features of the WAE’s manifolds based on their respective distributions with persistent homology. First, the points contained in the manifold inherited from , the manifold from and are randomly selected into respective batches. Two samples, from following and from following , are selected to differentiate the topological features of the manifold before and after the encoding-decoding. Similarly, two other samples are randomly selected from following to detect the scattered distribution of the manifold after the encoding. The samples and are contained in the spaces and , respectively. Then, the spaces and are transformed to metric space sets and for computational purposes. Then, we filter the metric space sets and using the Vietoris-Rips simplicial complex filtration. Given a line segment of length , vertices between data points are created for data points respectively separated from a smaller distance than . It leads to the construction of a collection of simplices resulting in Vietoris-Rips simplicial complex VR filtration. In our case, we decide to use the Vietoris-Rips simplicial complex as it offers the best compromise between the filtration accuracy and the memory requirement [10]. Subsequently, the persistence diagrams, and , are constructed. We recall a persistence diagram is a stable summary representation of topological features of simplicial complex. The persistence diagrams allow the computation of the bottleneck distance . The barcodes represent the lifespan of the homological features detected by the persistence diagrams, for instance the holes. The barcodes are a collection of the interval modules. Furthermore, the lifespan of a homological feature is defined by the boundaries of its interval module, respectively the birth time and the death time. Therefore, the barcodes illustrate in a simple way the birth-death of the pairing generators of the iterated inclusions. PHom-WAE is described in Algorithm 1.
4 Experiments
In this section, we empirically evaluate the proposed methodology PHom-WAE. We assess on a challenging data set for auto-encoders whether PHom-WAE can simultaneously achieve (i) accurate topological reconstruction of the data points and (ii) appropriate persistent homology mapping of the latent manifold.
Data Availability and Data Description We train PHom-WAE on one real-world open data set: the credit card transactions data set from the Kaggle database 111The data set is available at https://www.kaggle.com/mlg-ulb/creditcardfraud. containing 284 807 transactions including 492 frauds. This data set is particularly interesting because it underlines the chaotically scattered points of the encoded manifold that are found during the AE training. Furthermore, this data set is challenging because of the strong imbalance between normal and fraudulent transactions while being of high interest for the banking industry. To preserve transactions confidentiality, each transaction is composed of 28 components obtained with PCA without any description and two additional features Time and Amount that remained unchanged. Each transaction is labeled as fraudulent or normal in a feature called Class which takes a value of 1 in the case of fraud or 0 otherwise.
Experimental Setup and Code Availability In our experiments, we use the Euclidean latent space and the square cost function previously defined as for the data points . The dimensions of the true data set is . We kept the 28 components obtained with PCA and the amount resulting in a space of dimension 29. For the error minimization process, we used Adam gradient descent [34] with the parameters and a batch size of 64. Different values of for Wasserstein penalty have been tested, we empirically obtained the lowest error reconstruction with . The coefficients of persistence homology are evaluated within the field . We only consider homology groups and who represent the connected components and the loops, respectively. Higher dimensional homology groups did not noticeably improve the results quality while leading to longer computational time. The simulations were performed on a computer with 16GB of RAM, Intel i7 CPU and a Tesla K80 GPU accelerator. To ensure the reproducibility of the experiments, the code is available at the following address222The code is available at https://github.com/dagrate/PHom-WAE..
Results and Discussions on PHom-WAE against PHom-VAE We test PHom-WAE against PHom-VAE, Persistent Homology for Variational Auto-Encoder. We recall a Variational Auto-Encoder [8] uses a KL divergence, denoted by , composed of a reconstruction cost and a regularization term instead of an OT cost function. We use the same concepts introduced for PHom-WAE to define PHom-VAE. We compare the performance of PHom-WAE and PHom-VAE on two specificities: the latent manifold and the reconstructed data distribution following the generative model distribution for the samples .
As pictured in figures 5 and 6, both the persistence diagram and the barcodes between the original and the reconstructed distributions, respectively and , of the manifold are more widely distributed for PHom-WAE than for PHom-VAE. Additionally, the persistence diagram and the barcodes of PHom-WAE are qualitatively closer to those associated with the original data manifold . It means the topological features are better preserved for PHom-WAE than for PHom-VAE. It highlights a better encoding-decoding process thanks to the use of an optimal transport cost function. Furthermore, in figure 7, a topological representation of the original and the reconstructed distributions is highlighted. We observe the iterated inclusion chains are more similar for PHom-WAE than for PHom-VAE. For PHom-VAE, the inclusions of the reconstructed distribution are randomly scattered through the space without connected vertices.
In order to quantitatively assess the quality of the encoding-decoding process, we use the bottleneck distance between the persistent diagram of and the persistent diagram of of the reconstructed data points. We recall the strength of the bottleneck distance is to measure quantitatively the topological changes in the data, either the true or the reconstructed data, while being insensitive to the scale of the analysis. Traditional distance measures fail to acknowledge this as they do not rely on persistent homology and, therefore, can only reflect a measurement of the nearness relations of the data points without considering the overall shape of the data distribution. In table 1, we notice the smallest bottleneck distance, and therefore, the best result, is obtained with PHom-WAE. It means PHom-WAE is capable to better preserve the topological features of the original data distribution than PHom-VAE including the nearness measurements and the overall shape.
Last but not least, persistent homology and the bottleneck distance are used to highlight the scarcity of the distribution of the latent manifold . Using the bootstrapping technique of [35], we successively randomly select data samples contained in the manifold . The total number of selected samples is at least 50% of the total number of points contained in the manifold to ensure a reliable statistical representation. Assuming the data is not scattered, the bottleneck distance between the persistence diagrams of the samples is small. On the opposite, if the data is chaotically scattered in , then the topological features between the samples are significantly different, and consequently, the bottleneck distance is large. In table 2, the bottleneck distance is significantly lower for PHom-WAE than for PHom-VAE. Therefore, the level of scattered chaos for PHom-WAE is lower than for PHom-VAE. It also means the distribution of the latent manifold is better topologically preserved for PHom-WAE than for PHom-VAE. The reconstructed distribution of is, thus, less altered for PHom-WAE.
5 Conclusion
Building upon WAE and VAE, we introduce PHom-WAE and PHom-VAE, a new characterization of the manifolds of the WAE and VAE, respectively, that uses topology and persistence homology to highlight the manifold properties and the scattered points of the hidden space. We discussed their relations with other AE modeling techniques. Furthermore, relying on persistence homology, the bottleneck distance has been introduced to estimate quantitatively the alteration of the topological features occurring during the encoding-decoding process, a specificity that current traditional distance measures fail to acknowledge. We conducted experiments showing the performance of PHom-WAE in comparison to PHom-VAE using a challenging imbalanced real-world open data set containing credit card transactions, particularly suitable for the banking industry. We showed the superior performance of PHom-WAE in comparison to PHom-VAE. Future work will include further exploration of the topological features such as the influence of the simplicial complex and the possibility to integrate a topological optimization function as a regularization term.
The reference list from the paper itself. Each links out to its DOI / PubMed record.
- 1[1] Golub, G.H.: Cf van loan. Matrix computation, Baltimore, MD, USA (1989)
- 2[2] Carroll, J.D., Chang, J.J.: Analysis of individual differences in multidimensional scaling via an n-way generalization of “eckart-young” decomposition. Psychometrika 35 (3) (1970)
- 3[3] Kolda, T.G., Bader, B.W.: Tensor decompositions and applications. SIAM review 51 (3) (2009)
- 4[4] Paatero, P.: A weighted non-negative least squares algorithm for three-way ‘PARAFAC’ factor analysis. Chemometrics and Intelligent Laboratory Systems 38 (2) (1997)
- 5[5] Bader, B.W., Harshman, R.A., Kolda, T.G.: Temporal analysis of semantic graphs using asalsan. In: Data Mining, 2007. ICDM 2007. Seventh IEEE International Conference on. IEEE (2007)
- 6[6] Le Cun, Y., Boser, B., Denker, J.S., Henderson, D., Howard, R.E., Hubbard, W., Jackel, L.D.: Backpropagation applied to handwritten zip code recognition. Neural computation 1 (4), 541–551 (1989)
- 7[7] Hinton, G.E., Zemel, R.S.: Autoencoders, minimum description length and helmholtz free energy. In: Advances in neural information processing systems. pp. 3–10 (1994)
- 8[8] Kingma, D.P., Welling, M.: Auto-encoding variational bayes. ar Xiv preprint ar Xiv:1312.6114 (2013)
