Characterizing and Measuring the Similarity of Neural Networks with Persistent Homology

Characterizing the structural properties of neural networks is crucial yet poorly1 understood , and there are no well-established similarity measures between net-2 works . In this work , we observe that neural networks can be represented as abstract3 simplicial complex and analyzed using their topological ’ fingerprints ’ via Persis-4 tent Homology ( PH ) . We then describe a PH-based representation proposed for5 characterizing and measuring similarity of neural networks . We empirically show6 the effectiveness of this representation as a descriptor of different architectures7 in several datasets . This approach based on Topological Data Analysis is a step8 towards better understanding neural networks and serves as a useful similarity9 measure.10 1 Introduction11 Machine learning practitioners can train different neural networks for the same task . Even for the12 same neural architecture , there are many hyperparameters , such as the number of neurons per layer13 or the number of layers . Moreover , the final weights for the same architecture and hyperparameters14 can vary depending on the initialization and the optimization process itself , which is stochastic . Thus,15 there is no direct way of comparing neural networks accounting for the fact that neural networks16 solving the same task should be measured as being similar , regardless of the specific weights . This17 also prevents one from finding and comparing modules inside neural networks ( e.g. , determining if a18 given sub-network does the same function as other sub-network in another model ) . Moreover , there19 are no well-known methods for effectively characterizing neural networks.20 This work aims to characterize neural networks such that they can be measured to be similar21 once trained for the same task , with independence of the particular architecture , initialization , or22 optimization process . We focus on Multi-Layer Perceptrons ( MLPs ) for the sake of simplicity . We23 start by observing that we can represent a neural network as a directed weighted graph to which we24 can associate certain topological concepts.1 Considering it as a simplicial complex , we obtain its25 associated Persistent Diagram . Then , we can compute distances between Persistent Diagrams of26 different neural networks.27 The proposed experiments aim to show that the selected structural feature , Persistent Homology,28 serves to relate neural networks trained for similar problems and that such a comparison can be29 performed by means of a predefined measure between the associated Persistent Homology diagrams.30 To test the hypothesis , we study different classical problems ( MNIST , Fashion MNIST , CIFAR-10,31 and language identification and text classification datasets ) , different architectures ( number and size32 of layers ) as well as a control experiment ( input order ) .33 In summary , the main contributions of this work are the following:34 1See Jonsson [ 21 ] for a complete reference on graph topology . Submitted to 35th Conference on Neural Information Processing Systems ( NeurIPS 2021 ) . Do not distribute . • We propose an effective graph characterization strategy of neural networks based on Persis-35 tent Homology.36 • Based on this characterization , we suggest a similarity measure of neural networks.37 • We provide empirical evidence that this Persistent Homology framework captures valuable38 information from neural networks and that the proposed similarity measure is meaningful.39 The remainder of this paper is organized as follows . In Section 2 , we go through the related work.40 Then , in Section 3 we describe our proposal and the experimental framework to validate it . Finally , in41 sections 4 and 5 we report and discuss the results and arrive to conclusions , respectively.42 2 Related Work43 One of the fundamental papers of Topological Data Analysis ( TDA ) is presented in Carlsson [ 8 ] 44 and suggests the use of Algebraic Topology to obtain qualitative information and deal with metrics45 for large amounts of data . For an extensive overview of simplicial topology on graphs , see Giblin46 [ 18 ] , Jonsson [ 21 ] . Aktas et al . [ 2 ] provide a thorough analysis of PH methods.47 More recently , a number of publications have dealt with the study of the capacity of neural networks48 using PH . Guss and Salakhutdinov [ 19 ] characterize learnability of different neural architectures by49 computable measures of data complexity . Rieck et al . [ 30 ] introduce the neural persistence metric , a50 complexity measure based on TDA on weighted stratified graphs . This work suggests a representation51 of the neural network as a multipartite graph and the filtering of the Persistent Homology diagrams52 are performed for each layer independently . As the filtration contains at most 1-simplices ( edges ) ,53 they only capture zero-dimensional topological information , i.e . connectivity information . Donier54 [ 14 ] propose the concept of spatial capacity allocation analysis . Konuk and Smith [ 22 ] propose an55 empirical study of how NNs handle changes in topological complexity of the input data.56 In terms of pure neural network analysis , there are relevant works , like Hofer et al . [ 20 ] , that study57 topological regularization . Clough et al . [ 11 ] introduce a method for training neural networks for58 image segmentation with prior topology knowledge , specifically via Betti numbers . Corneanu et al.59 [ 13 ] try to estimate ( with limited success ) the performance gap between training and testing via60 neuron activations and linear regression of the Betti numbers.61 On the other hand , topological analysis of decision boundaries has been a very prolific area . Ra-62 mamurthy et al . [ 28 ] propose a labeled Vietoris-Rips complex to perform PH inference of decision63 boundaries for quantification of the complexity of neural networks.64 Naitzat et al . [ 27 ] experiment on the PH of a wide range of point cloud input datasets for a binary65 classification problems to see that NNs transform a topologically rich dataset ( in terms of Betti66 numbers ) into a topologically simpler one as it passes through the layers . They also verify that67 the reduction in Betti numbers is significantly faster for ReLU activations than hyperbolic tangent68 activations.69 Liu [ 25 ] obtain certain geometrical and topological properties of decision regions for neural models,70 and provide some principled guidance to designing and regularizing them . Additionally , they use71 curvatures of decision boundaries in terms of network weights , and the rotation index theorem72 together with the Gauss-Bonnet-Chern theorem.73 Regarding neural network representations , one of the most related works to ours , Gebhart et al . [ 16 ] ,74 focuses on topological representations of neural networks . They introduce a method for computing PH75 over the graphical activation structure of neural networks , which provides access to the task-relevant76 substructures activated throughout the network for a given input.77 Interestingly , in Watanabe and Yamana [ 35 ] , authors work on neural network representations through78 simplicial complexes based on deep Taylor decomposition and they calculate the PH of neural79 networks in this representation . In Chowdhury et al . [ 10 ] , they use directed homology to represent80 MLPs . They show that the path homology of these networks is non-trivial in higher dimensions and81 depends on the number and size of the network layers . They investigate homological differences82 between distinct neural network architectures.83 As far as neural network similarity measures are concerned , the literature is not especially prolific . In84 Kornblith et al . [ 23 ] , authors examine similarity measures for representations ( meaning , outputs of85 different layers ) of neural networks based on canonical correlation analysis . However , note that this86 method compares neural network representations ( intermediate outputs ) , not the neural networks87 themselves . Remarkably , in Ashmore and Gashler [ 3 ] , authors do deal with the intrinsic similarity88 of neural networks themselves based on Forward Bipartite Alignment . Specifically , they propose89 an algorithm for aligning the topological structures of two neural networks . Their algorithm finds90 optimal bipartite matches between the nodes of the two MLPs by solving the well-known graph91 cutting problem . The alignment enables applications such as visualizations or improving ensembles.92 However , the methods only works under very restrictive assumptions,2 and this line of work does not93 appear to have been followed up.94 Finally , we note that there has been a considerable growth of interest in applied topology in the95 recent years . This popularity increase and the development of new software libraries,3 along with the96 growth of computational capabilities , have empowered new works . Some of the most remarkable97 libraries are Ripser [ 32 , 5 ] , and Flagser [ 26 ] . They are focused on the efficient computation of PH.98 For GPU-Accelerated computation of Vietoris-Rips PH , Ripser++ [ 37 ] offers an important speedup.99 The Python library we are using , Giotto-TDA [ 31 ] , makes use of both above libraries underneath.100 We have seen that there is a trend towards the use of algebraic topology methods for having a better101 understanding of phenomena of neural networks and having more principled deep learning algorithms.102 Nevertheless , little to no works have proposed neural network characterizations or similarity measures103 based on intrinsic properties of the networks , which is what we intend to do.104 3 Methodology105 In this section , we propose our method , which is heavily based on concepts from algebraic topology.106 We refer the reader to the Supplementary Material for the mathematical definitions . In this section,107 we also describe the conducted experiments.108 Intrinsically characterizing and comparing neural networks is a difficult , unsolved problem . First , the109 network should be represented in an object that captures as much information as possible and then it110 should be compared with a measure depending on the latent structure . Due to the stochasticity of111 both the initialization and training procedure , networks are parameterized differently . For the same112 task , different functions that effectively solve it can be obtained . Being able to compare the trained113 networks can be helpful to detect similar neural structures.114 We want to obtain topological characterizations associated to neural networks trained on a given115 task . For doing so , we use the Persistence Homology ( from now on , PH ) of the graph associated to a116 neural network . We compute the PH for various neural networks learned on different tasks . We then117 compare all the diagrams for each one of the task.118 More specifically , for each of the studied tasks ( image classification on MNIST , Fashion MNIST and119 CIFAR-10 ; language identification , and text classification on the Reuters dataset ) ,4 we proceed as120 follows:121 • We train several neural network models on the particular problem.122 • We create a directed graph from the weights of the trained neural networks ( after changing123 the direction of the negative edges and normalising the weights of the edges ) .124 • We consider the directed graph as a simplicial complex and calculate its PH , using the125 weight of the edges as the filtering parameter , which range from 0 to 1 . This way we obtain126 the so-called Persistence Diagram.127 • We compute the distances between the Persistence Diagrams ( prior discretization of the128 Persistence Diagram so that it can be computed ) of the different networks.129 • Finally , we analyze the similarity between different neural networks trained for the same130 task , for a similar task , and for a completely different task , independently of the concrete131 architecture , to see whether there is topological similarity.132 2For example , the two neural networks `` must have the same number of units in each of their corresponding layers '' , and the match is done layer by layer . 3https : //www.math.colostate.edu/~adams/advising/appliedTopologySoftware/ 4For more details , see Section 3.2 . As baselines , we set two standard matrix comparison methods that are the 1-Norm and the Frobenius133 norm . Having adjacency matrix A and B , we compute the difference as norm ( A−B ) . However , these134 methods only work for matrices of similar size and thus , they are not general enough . We could also135 have used the Fast Approximate Quadratic assignment algorithm suggested in Vogelstein et al . [ 34 ] ,136 but for large networks this method becomes unfeasible to compute.137 3.1 Proposal138 Our method is as follows . We start by associating to a neural network a weighted directed graph139 that is analyzed as an abstract simplicial complex consisting on the union of points , edges , triangles,140 tetrahedrons and larger dimension polytopes ( those are the elements referred as simplices ) . Abstract141 simplicial complexes are used in opposition to geometric simplicial complexes , generated by a point142 cloud embedded in the Euclidean space Rn.143 Given a trained neural network , we take the collection of neural network parameters as directed and144 weighted edges that join neurons , represented by graph nodes . Biases are considered as new vertices145 that join target neurons with an edge having a given weight . Note that , in this representation , we lose146 the information about the activation functions , for simplicity and to avoid representing the network147 as a multiplex network . Bias information could also have been ignored because we want large PH148 groups that characterize the network , while these connections will not change the homology group149 dimension of any order.150 For negative edge weights , we reverse edge directions and maintain the absolute value of the weights.151 We discard the use of weight absolute value since neural networks are not invariant under weight sign152 transformations . This representation is consistent with the fact that every neuron can be replaced by a153 neuron from which two edges with opposite weights emerge and converge again on another neuron154 with opposite weights . From the point of view of homology , this would be represented as a closed155 cycle.156 We then normalize the weights of all the edges as expressed in Equation 1 where w is the weight157 to normalize , W are all the weights and ζ is an smoothing parameter that we set to 0.000001 . This158 smoothing parameter is necessary as we want to avoid normalized weights of edges to be 0 . This is159 because 0 implies a lack of connection.160 max ( 1− |w| max ( |max ( W ) | , |min ( W ) | ) , ζ ) ( 1 ) Given this weighted directed graph , we then define a directed flag complex associated to it . Topology161 of this directed flag complex can be studied using homology groups Hn . In this work we calculate162 homology groups up to degree 3 ( H0-H3 ) due to computational complexity and our neural network163 representation method ’ s layer connectivity limit.164 The dimensions of these homology groups are known as Betti numbers . The i-th Betti number is165 the number of i-dimensional voids in the simplicial complex ( β0 gives the number of connected166 components of the simplicial complex , β1 gives the number of non reducible loops and so on ) . For a167 deeper introduction to algebraic topology and computational topology , we refer to Edelsbrunner and168 Harer [ 15 ] , Ghrist [ 17 ] .169 We work with a family of simplicial complexes , Kε , for a range of values of ε ∈R so that the complex170 at step εt is embedded in the complex at εt+1 for εt ≤ εt+1 , i.e . Kε ⊆ Kεt+1 . In our case , ε is the171 minimum weight of included edges of our graph representation of neural networks.172 The nested family of simplicial complexes is called a filtration . We calculate a sequence of homology173 groups by varying the ε parameter , obtaining a persistence homology diagram . PH calculations are174 performed on Z2.175 This filtration gives a collection of contained directed weighted graph or simplicial complex Kεmin ⊆176 . . .⊆ Kεt ⊆ Kεt+1 ⊆ . . .⊆ Kεmax , where t ∈ [ 0,1 ] and εmin = 0 , εmax = 1 ( recall that edge weights are177 normalized ) .178 Given a filtration , one can look at the birth , when a homology class appears , and death , the time179 when the homology class disappears . The PH treats the birth and the death of these homological180 features in Kε for different ε values . Lifespan of each homological feature can be represented as181 an interval ( birth , death ) , of the homological feature . Given a filtration , one can record all these182 intervals by a Persistence Barcode ( PB ) [ 8 ] , or in a Persistence Diagram ( PD ) , as a collection of183 multiset of intervals.184 As mentioned previously , our interest in this work is to compare PDs from two different simplicial185 complexes . There are two distances traditionally used to compare PDs , Wasserstein distance and186 Bottleneck distance . Their stability with respect to perturbations on PDs has been object of different187 studies [ 9 , 12 ] .188 In order to make computations feasible and to obviate noisy intervals , we filter the PDs by limiting189 the minimum PD interval size . We do so by setting a minimum threshold η = 0.01 . Intervals with190 a lifespan under this value are not considered . Additionally , for computing distances , we need to191 remove infinity values . As we are only interested in the deaths until the maximum weight value , we192 replace all the infinity values by 1.0.193 Wasserstein distance calculations are computationally hard for large PDs ( each PD of our NN models194 has a million persistence intervals per diagram ) . Therefore we use a vectorized version of PDs instead,195 also called PD discretization . This vectorized version summaries have been proposed and used on196 recent literature [ 1 , 6 , 7 , 24 , 29 ] .197 For the persistence diagram distance calculation , we use the Giotto-TDA library [ 31 ] and compute198 the following supported vectorized persistence summaries : 1 . Persistence landscape . 2 . Weighted199 silhouette . 3 . Heat vectorizations.200 3.2 Experimental Framework201 Datasets To determine the topological structural properties of trained NNs , we select different202 kinds of datasets . We opt for four well-known benchmarks in the machine learning community203 and one regarding language identification : ( 1 ) the MNIST5 dataset for classifying handwritten digit204 images , ( 2 ) the Fashion MNIST [ 36 ] dataset for classifying clothing images into 10 categories , ( 3 ) the205 CIFAR-106 ( CIFAR ) dataset for classifying 10 different objects , ( 4 ) the Reuters dataset for classifying206 news into 46 topics , and ( 5 ) the Language Identification Wikipedia dataset7 for identifying 7 different207 languages.208 We selected these datasets because , apart from being well-known benchmarks , the performances209 without transfer learning are good enough and they have different data types and sizes . For CIFAR-210 10 and Fashion MNIST datasets we train a Convolutional Neural Network ( CNN ) first , and the211 convolutional layers are shared between all the models of the same dataset as a feature extractor.212 Recall that in this work we are focusing on MLPs , so we do not consider that convolutional weights.213 For the MNIST , Reuters and Language Identification datasets , we use an MLP . For Reuters and214 Language identification datasets , we vectorize the sentences with character frequency.215 Experiments Pipeline We study the following variables ( hyperparameters ) : 1 . Layer width,216 2 . Number of layers , 3 . Input order8 ) , 4 . Number of labels ( number of considered classes ) .217 We define the base architecture as the one with a layer width of 512 , 2 layers , the original features218 order , and considering all the classes ( 10 in the case of MNIST , Fashion MNIST and CIFAR , 46 in219 the case of Reuters and 7 in the case of the language identification task ) . Then , doing one change at a220 time , keeping the rest of the base architecture hyperparameters , we experiment with architectures221 with the following configurations:222 • Layer width : 128 , 256 , 512 ( base ) and 1024.223 • Number of layers : 2 ( base ) , 4 , 6 , 8 and 10.224 • Input order : 5 different randomizations ( with base structure ) , the control experiment.225 • Number of labels ( MNIST , Fashion MNIST , CIFAR-10 ) : 2 , 4 , 6 , 8 and 10 ( base ) .226 5http : //yann.lecun.com/exdb/mnist/ 6https : //www.cs.toronto.edu/~kriz/cifar.html 7https : //www.floydhub.com/floydhub/datasets/language-identification/1/data 8Order of the input features , the control experiment . This one should definitely not affect the performance in the neural networks , so if our method is correct , it should be uniform as per the proposed topological distances . • Number of labels ( Reuters ) : 2 , 6 , 12 , 23 and 46 ( base ) .227 • Number of labels ( Language Identification ) : 2 , 3 , 4 , 6 and 7 ( base ) .228 Note that this is not a grid search over all the combinations . We always modify one hyperparameter229 at a time , and keep the rest of them as in the base architecture . In other words , we experiment with all230 the combinations such that only one of the hyperparameters is set to a non-base value at a time.231 For each dataset , we train 5 times ( each with a different random weight initialization ) each of these232 neural network configurations . Then , we compute the topological distances ( persistence landscape,233 weighted silhouette , heat ) among the different architectures . In total , we obtain 5×5×3 distance234 matrices ( 5 datasets , 5 random initializations , 3 distance measures ) . Finally , we average the 5 random235 initializations , such that we get 5×3 matrices , one for each distance on each dataset . All the matrices236 have dimensions 19×19 , since 19 is the number of experiments for each dataset ( corresponding to237 the total the number of architectural configurations mentioned above ) . Note that the base architecture238 appears 8 times ( 1 , on the number of neurons per layer , 1 on the number of layers , 1 on the number239 of labels and the 5 randomizations of weight initializations ) .240 All experiments were executed in a machine with 2 NVIDIA V100 of 32GB , 2 Intel ( R ) Xeon ( R ) 241 Platinum 8176 CPU @ 2.10GHz , and of 1.5TB RAM , for a total of around 3 days.242 The code and results are fully open source9 under MIT license.243 4 Results & Discussion244 Results from control experiments can be seen in the245 third group on Figures 1 and 4 . In these figures , groups246 are separated visually using white dashed lines . Exper-247 iments groups are specified in Table 1 . Control exper-248 iments in all the images appear very dimmed , which249 means that they are very similar , as expected . Recall250 that the control experiments consist of 5 ( randomiza-251 tions ) × 5 ( executions ) and that 25 different neural252 networks have been trained ; each one of the network253 has more than 690,000 parameters that have been ran-254 domly initialized . After the training , results show that255 these networks have very close topological distance , as expected.256 9See Supplementary Material . For Figure 2 we computed both 1-norm and Frobenius norm ( the baselines ) for graphs ’ adjacency257 matrices of control experiments . Note that as we ran the experiment five times , we make the mean258 for each value of the matrix . In order to show whether the resulting values are positive or negative,259 we subtract to the maximum difference of each dataset the norm of each cell separately , we take the260 absolute value and we divide by the maximum difference of each dataset . Therefore , we obtain five261 values per dataset . Table 2 shows the statistics reflecting that the distance among the experiments are262 large and , thus , they are not characterizing any similarity but rather an important dissimilarity.263 In contrast , Figure 3 , with our method ( Silhouette ) , shows perfect diagonal of similarity blocks . In264 the corresponding numeric results , we obtained show small distances , as shown in Table 3 . We can265 appreciate that each dataset has its own hub . This confirms the validity of our proposed similarity266 measure.267 The method we present also seems to capture268 some parts of hyperparameter setup . For in-269 stance , in Figure 4 we can observe gradual in-270 crease of distances in the first group regarding271 layer size meaning that , as layer size increases,272 the topological distance increases too . Similarly,273 for the number of layers ( second group ) and274 number of labels ( fourth group ) the same situ-275 ation holds . Note that in Fashion MNIST and276 CIFAR-10 , the distances are dimmer because we277 are not dealing with the weights of the CNNs.278 Recall that the CNN acts as a frozen extractor279 and are pretrained for all runs ( with the same280 weights ) , such that the MLP layers themselves281 are the only potential source of dissimilarity be-282 tween runs.283 Thus , our characterization is sensitive to the architecture ( e.g. , if we increase the capacity , distances284 vary ) , but at the same time , as we saw before , it is not dataset-agnostic , meaning that it also captures285 whether two neural networks are learning the same problem or not.286 In Figure 4 , Fashion MNIST ( Figure 4b ) and CIFAR ( Figure 4c ) dataset results are interestingly287 different from those of MNIST ( Figure 4a ) dataset . This is , presumably , because both Fashion288 MNIST and CIFAR use a pretrained CNN for the problem . Thus , we must analyze the results taking289 into account this perspective . The first fully connected layer size is important as it can avoid a290 bottleneck from the previous CNN output . Some works in the literature show that adding multiple291 fully connected layers does not necessarily enhance the prediction capability of CNNs [ 4 ] , which292 is congruent with our results when adding fully connected layers ( experiments 5 to 9 ) that result in293 dimmer matrices than the one from . Concerning the experiments on input order , there is slightly294 more homogeneity than in MNIST , again showing that the order of sample has negligible influence.295 Moreover , there could have been even more homogeneity taking into account that the fully connected296 network reduced its variance thanks to the frozen weights of the CNN . This also supports the fact297 that the CNN is the main feature extractor of the network . As in MNIST results , CIFAR results show298 that the topological properties are , indeed , a mapping of the practical properties of neural networks.299 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 0.0 1.0 We refer to the Supplementary Material for all300 distance matrices for all datasets and all dis-301 tances , as well as for the standard deviations302 matrices and experiment group statistics.303 5 Conclusions & Future Work304 Results from different experiments , in five dif-305 ferent datasets from computer vision and natural306 language , lead to similar topological properties307 and are trivially interpretable , which yields to308 general applicability.309 The bests discretizations chosen for this work310 are the Heat and Silhouette . They show better311 separation of experiment groups , and are effec-312 tively reflecting changes in a sensitive way . We313 also explored the Landscape discretization but it314 offers a very low interpretability and clearance.315 In other words , it is not helpful for comparing PH diagrams associated to neural networks.316 The most remarkable conclusion comes from the control experiments . The corresponding neural317 networks , with different input order but the same architecture , are very close to each other . The PH318 framework does , indeed , abstract away the specific weight values , and captures latent information319 from the networks , allowing comparisons to be based on the function they approximate . The selected320 neural network representation is reliable and complete , and yields coherent and meaningful results.321 Instead , the baseline measures , the 1-Norm and the Frobenius norm , implied an important dissimilarity322 between the experiments in the control experiments , meaning that they did not capture the fact that323 these neural networks were very similar in terms of the solved problem.324 We conclude that our proposed characterization , does , indeed , capture meaningful information from325 neural network , and the computed distances can serve as an effective similarity measure between326 networks . To the best of our knowledge , this similarity measure between neural networks is the first327 of its kind.328 As future work , we suggest adapting the method to different deep learning libraries and make it329 support popular neural architectures such as CNNs , Recurrent Neural Networks , and Transformers330 [ 33 ] . Finally , we suggest performing more analysis regarding the learning of a neural network , and331 trying to topologically answer the question of how a neural network learns.332 Checklist333 1 . For all authors ... 334 ( a ) Do the main claims made in the abstract and introduction accurately reflect the paper ’ s335 contributions and scope ? [ Yes ] 336 ( b ) Did you describe the limitations of your work ? [ Yes ] See second paragraph of the337 introduction and last paragraph of the conclusions.338 ( c ) Did you discuss any potential negative societal impacts of your work ? [ N/A ] 339 ( d ) Have you read the ethics review guidelines and ensured that your paper conforms to340 them ? [ Yes ] 341 2 . If you are including theoretical results ... 342 ( a ) Did you state the full set of assumptions of all theoretical results ? [ N/A ] 343 ( b ) Did you include complete proofs of all theoretical results ? [ N/A ] 344 3 . If you ran experiments ... 345 ( a ) Did you include the code , data , and instructions needed to reproduce the main experi-346 mental results ( either in the supplemental material or as a URL ) ? [ Yes ] Both code and347 outputs.348 ( b ) Did you specify all the training details ( e.g. , data splits , hyperparameters , how they349 were chosen ) ? [ Yes ] Check the Experimental Framework Section and the code.350 ( c ) Did you report error bars ( e.g. , with respect to the random seed after running ex-351 periments multiple times ) ? [ Yes ] We include means , standard deviations and raw352 outputs.353 ( d ) Did you include the total amount of compute and the type of resources used ( e.g. , type354 of GPUs , internal cluster , or cloud provider ) ? [ Yes ] Check Experimental Framework355 Section.356 4 . If you are using existing assets ( e.g. , code , data , models ) or curating/releasing new assets ... 357 ( a ) If your work uses existing assets , did you cite the creators ? [ Yes ] In the case of the358 datasets . We do not use any other additional asset.359 ( b ) Did you mention the license of the assets ? [ No ] 360 ( c ) Did you include any new assets either in the supplemental material or as a URL ? [ Yes ] 361 Code , results and pictures we have made for explanations.362 ( d ) Did you discuss whether and how consent was obtained from people whose data you ’ re363 using/curating ? [ N/A ] 364 ( e ) Did you discuss whether the data you are using/curating contains personally identifiable365 information or offensive content ? [ N/A ] 366 5 . If you used crowdsourcing or conducted research with human subjects ... 367 ( a ) Did you include the full text of instructions given to participants and screenshots , if368 applicable ? [ N/A ] 369 ( b ) Did you describe any potential participant risks , with links to Institutional Review370 Board ( IRB ) approvals , if applicable ? [ N/A ] 371 ( c ) Did you include the estimated hourly wage paid to participants and the total amount372 spent on participant compensation ? [ N/A ] 373 References374 [ 1 ] H. Adams , T. Emerson , M. Kirby , R. Neville , C. Peterson , P. Shipman , S. Chepushtanova,375 E. Hanson , F. Motta , and L. Ziegelmeier . Persistence images : A stable vector representation of376 persistent homology . J. Mach . Learn . Res. , 18:8:1–8:35 , 2017.377 [ 2 ] M. Aktas , E. Akbaş , and A. E. Fatmaoui . Persistence homology of networks : methods and378 applications . Applied Network Science , 4:1–28 , 2019.379 [ 3 ] S. Ashmore and M. Gashler . A method for finding similarity between multi-layer perceptrons380 by forward bipartite alignment . In 2015 International Joint Conference on Neural Networks381 ( IJCNN ) , pages 1–7 , 2015. doi : 10.1109/IJCNN.2015.7280769.382 [ 4 ] S. H. S. Basha , S. R. Dubey , V. Pulabaigari , and S. Mukherjee . Impact of fully connected383 layers on performance of convolutional neural networks for image classification . CoRR,384 abs/1902.02771 , 2019 . URL http : //arxiv.org/abs/1902.02771.385 [ 5 ] U. Bauer . Ripser : efficient computation of vietoris-rips persistence barcodes , 2021.386 [ 6 ] E. Berry , Y.-C. Chen , J. Cisewski-Kehe , and B. T. Fasy . Functional summaries of persistence387 diagrams . Journal of Applied and Computational Topology , 4:211–262 , 2020.388 [ 7 ] P. Bubenik . Statistical topological data analysis using persistence landscapes . J. Mach . Learn.389 Res. , 16:77–102 , 2015.390 [ 8 ] G. Carlsson . Topology and data . Bulletin of the American Mathematical Society , 46:255–308,391 2009.392 [ 9 ] F. Chazal , V. D. Silva , and S. Oudot . Persistence stability for geometric complexes . Geometriae393 Dedicata , 173:193–214 , 2012.394 [ 10 ] S. Chowdhury , T. Gebhart , S. Huntsman , and M. Yutin . Path homologies of deep feedforward395 networks . 2019 18th IEEE International Conference On Machine Learning And Applications396 ( ICMLA ) , pages 1077–1082 , 2019.397 [ 11 ] J. Clough , I. Öksüz , N. Byrne , V. Zimmer , J . A. Schnabel , and A. P. King . A topological398 loss function for deep-learning based image segmentation using persistent homology . IEEE399 transactions on pattern analysis and machine intelligence , PP , 2020.400 [ 12 ] D. Cohen-Steiner , H. Edelsbrunner , and J. Harer . Stability of persistence diagrams . Proceedings401 of the twenty-first annual symposium on Computational geometry , 2005.402 [ 13 ] C. Corneanu , M. Madadi , S. Escalera , and A. Martínez . Computing the testing error without a403 testing set . 2020 IEEE/CVF Conference on Computer Vision and Pattern Recognition ( CVPR ) ,404 pages 2674–2682 , 2020.405 [ 14 ] J. Donier . Capacity allocation analysis of neural networks : A tool for principled architecture406 design . ArXiv , abs/1902.04485 , 2019.407 [ 15 ] H. Edelsbrunner and J. Harer . Computational Topology - an Introduction . American Mathemat-408 ical Society , 2009.409 [ 16 ] T. Gebhart , P. Schrater , and A. Hylton . Characterizing the shape of activation space in deep neu-410 ral networks . 2019 18th IEEE International Conference On Machine Learning And Applications411 ( ICMLA ) , pages 1537–1542 , 2019.412 [ 17 ] R. Ghrist . Elementary Applied Topology . Self-published , 2014.413 [ 18 ] P. Giblin . Graphs , surfaces , and homology : an introduction to algebraic topology . Chapman414 and Hall , 1977.415 [ 19 ] W. H. Guss and R. Salakhutdinov . On characterizing the capacity of neural networks using416 algebraic topology . ArXiv , abs/1802.04443 , 2018.417 [ 20 ] C. Hofer , F. Graf , M. Niethammer , and R. Kwitt . Topologically densified distributions . ArXiv,418 abs/2002.04805 , 2020.419 [ 21 ] J. Jonsson . Simplicial complexes of graphs . PhD thesis , KTH Royal Institute of Technology,420 2007.421 [ 22 ] E. Konuk and K. Smith . An empirical study of the relation between network architecture and422 complexity . 2019 IEEE/CVF International Conference on Computer Vision Workshop ( ICCVW ) ,423 pages 4597–4599 , 2019.424 [ 23 ] S. Kornblith , M. Norouzi , H. Lee , and G. E. Hinton . Similarity of neural network representations425 revisited . CoRR , abs/1905.00414 , 2019 . URL http : //arxiv.org/abs/1905.00414.426 [ 24 ] P. Lawson , A. Sholl , J . Brown , B. T. Fasy , and C. Wenk . Persistent homology for the quantitative427 evaluation of architectural features in prostate cancer histology . Scientific Reports , 9 , 2019.428 [ 25 ] B. Liu . Geometry and topology of deep neural networks ’ decision boundaries . ArXiv,429 abs/2003.03687 , 2020.430 [ 26 ] D. Lütgehetmann , D. Govc , J. Smith , and R. Levi . Computing persistent homology of directed431 flag complexes . arXiv : Algebraic Topology , 2019.432 [ 27 ] G. Naitzat , A. Zhitnikov , and L. Lim . Topology of deep neural networks . J. Mach . Learn . Res.,433 21:184:1–184:40 , 2020.434 [ 28 ] K. Ramamurthy , K. R. Varshney , and K. Mody . Topological data analysis of decision boundaries435 with application to model selection . ArXiv , abs/1805.09949 , 2019.436 [ 29 ] B . A. Rieck , F. Sadlo , and H. Leitte . Topological machine learning with persistence indicator437 functions . ArXiv , abs/1907.13496 , 2019.438 [ 30 ] B . A. Rieck , M. Togninalli , C. Bock , M. Moor , M. Horn , T. Gumbsch , and K. Borgwardt.439 Neural persistence : A complexity measure for deep neural networks using algebraic topology.440 ArXiv , abs/1812.09764 , 2019.441 [ 31 ] G. Tauzin , U. Lupo , L. Tunstall , J . B. Pérez , M. Caorsi , A. Medina-Mardones , A. Dassatti,442 and K. Hess . giotto-tda : A topological data analysis toolkit for machine learning and data443 exploration , 2020.444 [ 32 ] C. Tralie , N. Saul , and R. Bar-On . Ripser.py : A lean persistent homology library for python.445 The Journal of Open Source Software , 3 ( 29 ) :925 , Sep 2018. doi : 10.21105/joss.00925 . URL446 https : //doi.org/10.21105/joss.00925.447 [ 33 ] A. Vaswani , N. Shazeer , N. Parmar , J. Uszkoreit , L. Jones , A. N. Gomez , L. Kaiser , and448 I. Polosukhin . Attention is all you need . CoRR , abs/1706.03762 , 2017 . URL http : //arxiv.449 org/abs/1706.03762.450 [ 34 ] J. T. Vogelstein , J. M. Conroy , V. Lyzinski , L. J. Podrazik , S. G. Kratzer , E. T. Harley , D. E.451 Fishkind , R. J. Vogelstein , and C. E. Priebe . Fast approximate quadratic programming for452 graph matching . PLOS ONE , 10 ( 4 ) :1–17 , 04 2015. doi : 10.1371/journal.pone.0121002 . URL453 https : //doi.org/10.1371/journal.pone.0121002.454 [ 35 ] S. Watanabe and H. Yamana . Topological measurement of deep neural networks using persistent455 homology . In ISAIM , 2020.456 [ 36 ] H. Xiao , K. Rasul , and R. Vollgraf . Fashion-mnist : a novel image dataset for benchmarking457 machine learning algorithms , 2017.458 [ 37 ] S. Zhang , M. Xiao , and H. Wang . Gpu-accelerated computation of vietoris-rips persistence459 barcodes . In Symposium on Computational Geometry , 2020.460

Summary: This paper tries to measure the structural similarity of the neural networks by associating them with simplicial complexes. The similarity between neural networks is then measured by the topological feature via persistence homology. The graph is generated by taking the neurons as graph nodes, and the edge weights are defined as the network parameters for the connected neurons. The directed flag complex is attached to the constructed weighted directed graph, then the filtration, a family of simplicial complexes for the neural networks. The persistence diagram and persistence barcode are calculated for the filtration. They are used to show the three persistence summaries: persistence landscape, weighted silhouette and heat vectorizations.  Experiments were carried out for various benchmarks for typical CNN architectures.