R ANDOM FILTERS FOR ENRICHING THE DISCRIMINATORY POWER OF TOPOLOGICAL REPRESENTATIONS
A BSTRACT
Topological representations of data are inherently coarse summaries which endows them with certain desirable properties like stability but also potentially inhibits their discriminatory power relative to ﬁne-scale learned features.
In this work we present a novel framework for enriching the discriminatory power of topological representations based on random ﬁlters and capturing “interference topology” rather than direct topology.
We show that our random ﬁlters outperform previously explored structured image ﬁlters while requiring orders of magnitude less computational time.
The approach is demonstrated on the MNIST dataset but is broadly applicable across data sets and modalities.
This work is concluded with a discussion of the mathematical intuition underlying the approach and identiﬁcation of future directions to enable deeper understanding and theoretical results.
I NTRODUCTION
One of the fundamental challenges of machine learning is developing methods to distill a potentially complex and high-dimensional dataset into a set of features that can be used to perform a speciﬁc task.
Deep learning models have been successful in a range of problem spaces, from image recognition to object detection LeCun et al.
(2015), due to their ability to learn high-performance, analysisdependent features.
In the last decade there has been an explosion of work in topological data analysis Carlsson (2009), a relatively new ﬁeld that explores the application of topology-inspired statistics to problems in data science.
Unlike the features extracted by deep learning algorithms, the mathematical ﬁeld of topology studies coarse properties associated to shape.
Topological features have a range of attractive properties and there has been recent interest (for example, Kindelan et al.
(2021)) in explicitly merging the beneﬁts of topologically-inspired features with the discriminatory power of deep learning frameworks.
The present work is a step toward building this connection.
In this work we narrow our focus to the problem of extracting topological features from image data.
We employ the lower star ﬁltration (LSF), a common method for extracting topological features from grayscale images, that creates simplicial complexes based on relative pixel intensities.
One contribution of this work is a method for addressing challenges that arise when working with image data expressing low topological variation.
Speciﬁcally, we address the challenge when the LSF on its own fails to extract enough features to distinguish between different classes in a supervised learning task.
A concrete example of this is the MNIST dataset LeCun et al.
(1998) where, for example, the digits “0”,“6”, and “9” are topologically equivalent.
We introduce a novel approach that blends a given image with a collection of random images (formed by applying a Gaussian blurring kernel to a uniform random noise matrix) to enrich the discriminatory power of topological features captured from the lower star ﬁltration.
Intuitively, rather than capturing the topological structure demonstrated in the base image, we look at how the base image alters topological structures across the set of secondary images.
We demonstrate that the pipeline comprised of random ﬁlters and LSF, summarized by a set of persistence images (PIs)
Adams et al.
(2017), is able to improve classiﬁcation performance on MNIST.
Unlike the approach presented in Garin & Tauzin (2019) that leverages computationally expensive, structured ﬁlters and random forest classiﬁers, this work integrates the topological representation into a convolutional neural network (CNN) classiﬁcation model applied to a multi-channel PI formed from multiple ﬁlters.
Further, we show that topological features provide a stronger starting point for the
CNN-based classiﬁcation rather than the raw grayscale MNIST images.
The remainder of this paper is structured as follows.
First, in Section 2 we present a brief primer on topological data analysis including an introduction to the LSF.
Next, in Section 3 we present our novel, random ﬁlter approach.
Section 4 presents computational results for the MNIST dataset.
Finally, we conclude with a discussion of our ﬁndings and identiﬁcation of next steps for formalizing and building theoretical understanding of the developed approach.
A BRIEF PRIMER ON TOPOLOGICAL DATA ANALYSIS
A fundamental tool in the application of topology to data science is persistent homology , ﬁrst introduced in Edelsbrunner et al.
This tool tracks the formation and vanishing of features along a given nested sequence of topological spaces, capturing the features as generators in the corresponding persistent homology groups.
The set of pairs of indices in the nested sequence where features ﬁrst appear and disappear (colloquially referred to as birth and death times) is known as a persistence diagram (PD) and provides a convenient way of recording the feature information by simply tracking how long they “persist” in the sequence.
In the case of grayscale image data, it is common to consider the image as a discrete sampling of 2-dimensional function and deﬁne the topology based on the levelsets of that function using the LSF.
Figures 1 and 2 provide visualizations of the LSFsfor unﬁltered and ﬁltered MNIST images, respectively.
The corresponding 0- and 1-dimensional
PDs for each LSF are also provided.
These PDs are then converted to PIs as outlined in Adams et al.
R ANDOM FILTERS FOR ENRICHING TOPOLOGICAL REPRESENTATIONS
Our technical approach addresses the setting when there is insufﬁcient topological variation to achieve strong discrimination across a data set by extracting topological features from the raw data alone.
Particularly, we focus on the MNIST dataset where the LSF computed directly from the grayscale images fails to produce sufﬁciently discriminatory topological representations.
In Garin & Tauzin (2019) the authors were able to successfully classify MNIST images with a random forest using features extracted from a similar LSF by diversifying the topological structure through the application of structured ﬁlters; they did this by ﬁrst applying several traditional binary-to-grayscale image ﬁlters to binarizations of the MNIST images.
However, some of those ﬁlters can be expensive to compute and have limited diversity.
With this in mind, we introduce the following family of computationally inexpensive ﬁlters.
Building on the foundation laid in Garin & Tauzin (2019), we create a more ﬂexible framework building on random rather than structured ﬁlters.
We deﬁne a random ﬁlter to be an m × n grayscale image formed by convolving a random matrix (with entries sampled uniformly from [0 , 1] ) with a
Gaussian blurring kernel.
A random ﬁlter, R , is applied to an arbitrary m × n grayscale image, I , from the dataset via elementwise multiplication; the ﬁltered image is R (cid:12) I .
In the speciﬁc situation of MNIST, the pixel variation induced by helps the shape of each an “imprint” on the topological information of that ﬁlter.
Figure 2 shows this in action, repeating the experiment of Figure 1 but for the MNIST images after application of a random ﬁlter (Figure 3).
It can be seen in Figure 3 that the shape of the digit 5 enables a loop to form early on while no loops form in the corresponding complex for the digit 1 at that time; this is a distinction between the digits that is now captured by the topological representation.
We further boost the discriminatory power by forming N random ﬁlters, R 1 , . . .
, R N .
For each grayscale image I in the dataset, we create the dimension 0 , 1 PIs of each R i (cid:12) I .
Thus, I is represented by 2 N PIs total and these are stacked to create the input tensor (that is, a multi-channel PI) for the CNN.
The formation of a multi-channel
PI for integration with CNN classiﬁers is a further novel contribution of this work.
While this work only considers application of random ﬁlters to grayscale images the intuition is widely applicable: in the absence of sufﬁcient topological variation across classes one may instead consider the notion of “interference topology” to achieve stronger discrimination across classes.
C LASSIFYING MNIST WITH RANDOM FILTERS AND PERSISTENCE IMAGES
We examine the effectiveness of our preprocessing approach on the MNIST dataset consisting of 60 , 000 training samples of handwritten digits and 10 , 000 test samples.
Since MNIST is a wellsolved classiﬁcation task with small CNNs like LeNet able to get ≈ 99% test accuracy, we compare the effectiveness of the same CNN architecture applied to both the raw MNIST images (of size 28 × 28 pixels) and our multi-channel PI for the purpose of benchmarking our TDA pipeline.
To that end, the results presented in Table 1 were produced using a simple CNN architecture consisting
[Table]
of a single convolutional layer with 1 × 1 convolutional ﬁlters, a ReLU activation layer
[Table]
and a single fully connected layer.
No pooling or dropout is used.
It was shown in Adams et al.
(2017) that PIs are robust to the choice of resolution.
We explored the trade-off between PI resolution and the number of random ﬁlters on classiﬁcation accuracy.
The results of this experiment are provided in Appendix A and led us to choose to use 7 × 7 resolution
PIs.
We report the accuracies of three topological methods in Table 1: the accuracy from using
PIs generated from the 25 structured ﬁlters (raw grayscale, inverted raw grayscale, height, radial, density, dilation, erosion, and signed distance) deﬁned in Garin & Tauzin (2019) with their hyperparameter choices
[Table]
and the accuracy from using PIs obtained from 25 and 80 random ﬁlters.
Because we compute both the dimension 0 and dimension 1 persistence images for each ﬁltered image, the total numbers of input channels into the CNN are 50 and 160 , respectively.
For reference, we also report the test accuracy from using the same architecture on the raw, 28 × 28 grayscale MNIST images.
From the results in Table 1 it is easily seen that for the same number of ﬁlters, the random ﬁlters achieve superior classiﬁcation though both topological approaches outperform the same architecture applied to the raw data.
Finally, we also see that there is increased performance gains for the larger number of random ﬁlters.
In Table 2, we compare run times from generating the 25 structured image ﬁlters and 25 random ﬁlters.
The structured ﬁlters are several orders of magnitude slower than our novel random ﬁlters.
This is likely partly due to inefﬁciencies in our iterative implementations of the traditional ﬁlter algorithms.
However, for the random ﬁlters the source smoothed noise images only need to be generated once and the application of each depends only on elementwise multiplication which is already highly optimized in Python libraries such as NumPy.
D ISCUSSION AND F UTURE W ORK
We have presented a novel approach for boosting the discriminatory power of topological features through the use of random ﬁlters.
These random ﬁlters produce richer topological representations and higher MNIST classiﬁcation accuracy than previously employed structured ﬁlters while dramatically reducing computational run times.
This work is also contributes a novel approach for forming multi-channel PIs which can be integrated into CNN architectures.
One avenue of future exploration will focus on the determination of optimal architectures for analysis of PIs.
This paper focused solely on the concrete example of the MNIST data set where the raw data has insufﬁcient topological variation for discrimination.
Our ﬁndings suggest that coarse topological features, when collected from multiple perspectives, provides richer, more discriminatory topological representations.
Intuitively, this ﬁnding is likely related to random projections where one can understand data more comprehensively using many projections rather than one.
Future efforts will [Table] formalize this connection to provide greater theoretical understanding and generalize the framework for widespread application.
A P ERSISTENCE IMAGE RESOLUTION AND NUMBER OF RANDOM FILTERS
In this auxiliary section, we describe an experiment that identiﬁes the effect of resolution and number of random ﬁlters on classiﬁcation accuracy.
We train CNNs of the same shape as the model used in Section 4 (that is, a single convolutional layer with 1 × 1 ﬁlters followed by a linear layer) on a small subset of MNIST consisting of 2 , 100 evenly sampled training images and 900 evenly sampled testing images.
For each of a range of possible persistence image resolutions, we train a model using peristence images of that resolution for different numbers of random ﬁlters.
The mean accuracies over ﬁve trials are reported in Figure 4.
In all cases, using too few random ﬁlters (e.g., < 15 ) appears to be deleterious; more “perspectives” are needed to successfully distinguish between the MNIST images.
Using a larger resolution also helps improve accuracy, though for both resolution and number of ﬁlters the beneﬁt from increasing either is diminishing.
We chose 7 × 7 resolution persistence images for the experiments in Section 4 as a compromise between accuracy and the size of the input tensor.
For example, using 80 random ﬁlters and 30 ×persistence images would require using roughly 160 times the amount of RAM that MNIST images consume by themselves which can be impractical.