Tropical Coordinates on the Space of Persistence Barcodes

The aim of applied topology is to use and develop topological methods for applied mathematics, science and engineering. One of the main tools is persistent homology, an adaptation of classical homology, which assigns a barcode, i.e., a collection of intervals, to a finite metric space. Because of the nature of the invariant, barcodes are not well adapted for use by practitioners in machine learning tasks. We can circumvent this problem by assigning numerical quantities to barcodes, and these outputs can then be used as input to standard algorithms. It is the purpose of this paper to identify tropical coordinates on the space of barcodes and prove that they are stable with respect to the bottleneck distance and Wasserstein distances.


Introduction
In the past two decades, with the emergence of 'big data', topology started playing a more prominent role in data analysis [6,5].Topological ideas have inspired methods for visualizing complex datasets [29] as well as 'measuring' the shape of data.Using the most famous example of the latter, persistent homology [8,16], researchers have solved problems in sensor networks [21,3], medicine [2,19], neuroscience [11,22,15] and gained insights into texture images [27].
The output of persistent homology is a barcode, i.e. a collection of intervals.The unusual structure of the invariant makes the method hard to combine with standard algorithms within machine learning.For this reason various attempts have been made to assign numerical quantities to barcodes or to send these objects into a Hilbert space through a feature map, where computations are easier [28,9,17,18,4,1,10].For example, Di Fabio and Ferri [17,18] assign complex vectors to barcodes, Bubenik [4] persistence landscapes.
Adcock et al. [1] identified an algebra of polynomials on the barcode space that can be used as coordinates.The problem with these functions is that they are not stable (i.e.Lipschitz) with respect to the Bottleneck and Wasserstein p-distances usually used.This prompted us to search for other types of coordinates.All the aforementioned distances on the barcode space are defined by matching intervals from one barcode to another and computing penalties that involve taking maxima.For this reason the max and min functions, i.e. tropical functions, seemed like a natural choice and as it turns out they are indeed more suitable given the underlying structure of the barcode space.
We represent a barcode with exactly n intervals as a vector (x 1 , d 1 , x 2 , d 2 , , . . ., x n , d n ), where x i denotes the left endpoint of the i-th interval and d i its length.We assume that x i ≥ 0 for all i.This is not unreasonable since when constructing simplicial complexes from point clouds, the parameter is radius, which is nonnegative.This condition is also crucial later on in the construction when taking filtered inverse limits as it ensures a good behavior of certain maps when appropriately restricted.Since the ordering of the intervals does not matter, we take the orbit space, B n , of the action of the symmetric group on n letters on the product ([0, ∞)×[0, ∞)) n given by permuting the coordinates.The barcode space, B, is the quotient where ∼ is generated by equivalences of the form {(x 1 , d 1 ), (x 2 , d 2 ), . . ., (x n , d n )} ∼ {(x 1 , d 1 ), (x 2 , d 2 ), . . ., (x n−1 , d n−1 )}, whenever d n = 0.
After a short review of tropical algebra and persistent homology in Sections 2 and 3, Section 4 is devoted to establishing the properties of 2-symmetric max-plus polynomials that respect this equivalence relation.In particular, Theorem 4.5 provides a list of generators for this semiring.Unfortunately, this condition is so limiting that the only functions satisfying it involve only lengths of intervals.While we prove that these are individually stable with respect to the bottleneck and Wasserstein distances, there are not enough of them to separate the barcodes.In fact, in contrast to ordinary polynomials, no finite set exists that separates barcodes in B n (Theorem 6.1).This forces us to expand the semiring of observed functions to tropical rational functions.We find a countable generating set (Theorem 6.7) that separates the barcodes and prove that each function in this set is stable with respect to the bottleneck and Wasserstein distances (Theorems 7.1 and 7.3).These functions and their sums, minima and maxima can be used by researchers interested in analyzing datasets of shapes.In Section 8 we give an example that demonstrates how they can be used to classify digits from the MNIST dataset.
Of course, a natural question that arises is how to select finitely many functions from this infinite family that we identify.In the case when we deal with barcodes whose birth and death times only take finitely many values it is not hard to find finitely many functions that separate them (this is further discussed in Section 8 on a particular example).Even here we might run into trouble because the vectors we obtain might be very high dimensional.We are currently working on automating this step and using machine learning methods (for example, the Lasso method) on this collection of coordinate functions to select their weights.

Tropical Functions
This section reviews the material that first appeared in Symmetric and r-Symmetric Tropical Polynomials and Rational Functions [7].

Min-plus and Max-plus Polynomials
Tropical algebra is based on the study of the tropical semiring (R ∪ {∞}, ⊕, ).In this semiring, addition and multiplication are defined as follows: Both are commutative and associative.The times operator takes precedence when plus ⊕ and times occur in the same expression.The distributive law holds: Moreover, the Frobenius identity (Freshman's Dream) holds for all powers n in tropical arithmetic: Both arithmetic operations have a neutral element.Infinity is the neutral element for addition and zero is the neutral element for multiplication: x ⊕ ∞ = x and x 0 = x.Related to the tropical semiring is the arctic semiring (R ∪ {−∞}, , ), where multiplication of two elements is defined as before, but adding means taking their maximum instead of the minimum: and a b := a + b.
Its operations are associative, commutative and distributive as in the tropical semiring.
Let x 1 , x 2 , . . ., x n be variables representing elements in the max-plus semiring.A maxplus monomial expression is any product of these variables, where repetition is allowed.By commutativity, we can sort the product and write monomial expressions with the variables raised to exponents.
A max-plus polynomial expression is a finite linear combination of max-plus monomial expressions: Here the coefficients a 1 , a 2 , . . .a m are real numbers and the exponents a i j for 1 ≤ j ≤ n and 1 ≤ i ≤ m are nonnegative integers.
The total degree of a max-plus expression p(x 1 , x 2 , . . ., x n ) is The passage from max-plus polynomial expressions to functions is not one-to-one.For example, for all x 1 , x 2 and therefore the functions defined by x 2 1 x 2 2 and x 2 1 x 2 2 x 1 x 2 are the same, though the expressions are formally different.
Considered as a function, p : R n → R has the following three properties: • p is piecewise-linear, where the number of pieces is finite, and Max-plus monomials are the linear functions with nonnegative integer coefficients.
Let p and q be max-plus polynomial expressions.If then p and q are functionally equivalent.We write p ∼ q.
The minimal representation of a max-plus polynomial p is such a max-plus expression Definition 2.2.Max-plus polynomials are the semiring of equivalence classes of maxplus polynomial expressions with respect to ∼.In the case of n variables we denote the semiring by MaxPlus[x 1 , x 2 , . . ., x n ].
We define min-plus polynomials expression as max-plus with replaced by ⊕.We define the degree of a min-plus polynomial expression analogously.It can be shown that degrees of all max-plus (min-plus) expressions in the same equivalence class are the same and that it is therefore possible to define the degree of a max-plus (min-plus) polynomial.

Rational Tropical Functions
A tropical rational expression r is a quotient where p and q are min-plus polynomial expressions.
Definition 2.4.The semiring of equivalence classes of tropical rational expressions with respect to the functional equivalence relation is RTrop[x 1 , x 2 , . . ., x n ] and is called the semiring of rational tropical functions.
We will need the following statement later on.Lemma 2.5.A tropical rational function r in n variables gives a decomposition of R n into a family of closures of open sets on which the function is affine, and the boundaries of these domains are piecewise linear.
Proof.A min-plus polynomial p is a piecewise-linear concave function, and its domains of linearity consist of the cells in a polyhedral subdivision Σ p as in [24,Definition 2.5.5].A tropical rational function r has the form p − q where p and q are both min-plus polynomials.Let Σ = Σ p ∧ Σ q be the common refinement of the corresponding polyhedral decompositions of R n , as defined prior to [24, equation (2.3.1)].Then p − q is linear on each cell of Σ, and the boundaries of these cells are polyhedral balls or spheres.

Since
− min(a, b) = max(−a, −b), tropical rational expressions are composed by taking finitely many maxima and minima of linear functions, i.e. the set of tropical rational expressions is the smallest subset of functions R n → R containing all constant maps and projections that is closed under taking finitely many +, min and max.
Conversely, any function from the latter set can be represented by an expression of the form p q −1 , where p and q are tropical polynomial expressions.The algorithm to produce p and q is the usual one of adding fractions by finding a common denominator, but performed in tropical arithmetic [7].

Symmetric and 2-Symmetric Tropical Functions
for every permutation π ∈ S n .
The following version of the Fundamental Theorem of Symmetric Polynomials holds.
A tropical function in n variables is symmetric if it is invariant under the action of S n that permutes the variables.We can generalize this definition as follows: a tropical function in nr variables, divided into n blocks of r variables each, is r-symmetric if it is invariant under the action of S n that permutes the blocks while preserving the order of the variables within each block.We state the results for r = 2 because persistence barcodes are collections of intervals.
for every permutation π ∈ S n .
Fix n.Let the symmetric group S n act on the matrix of indeterminates We denote the set of orbits under the row permutation action on Including the [0] 2 n matrix in the definition of monomials would have been redundant as the 0 function can be expressed in terms of other 2-symmetric max-plus polynomials (by simply raising them to 0).Definition 2.10.We call the 2-symmetric max-plus polynomials that arise from orbits E n /S n elementary.We let σ (e 1,1 ,e 1,2 ),...,(e n,1 ,e n,2 ) denote the tropical polynomial that arises from the orbit More generally, for n and k ≤ n, σ (0,1) k is the total length of the k longest bars and σ (1,0) k is the sum of the k latest birth times.
There are enough 2-symmetric max-plus polynomials to separate the orbits.We will need this piece of information to show that the functions we define in Section 6 separate barcodes.

Persistent Homology
Classical topologists developed homology in order to 'measure' shape.In simplest terms, homology counts the occurrences of patterns, such as the number of connected components, loops and voids.The adaptation of homology to the study of point cloud data and more generally, filtrations of simplicial complexes, is persistent homology [20,16,8].
The motivating idea is that the union of discs with radius r centered around points from the data set approximates the underlying shape of the point cloud.We do not know a priori how to choose the radius.Persistent homology computes and keeps track of the changes in the homology these unions of discs over a range of radii parameters r.The output is a barcode, ie. a collection of intervals.Each interval corresponds to a topological feature which appears at the value of a parameter given by the left endpoint of the interval and disappears at the value given by the right endpoint.These barcodes play an analogous role as a histogram would in summarizing the shape of the datalong intervals correspond to strong topological signals and short ones may correspond to noise.

Barcode Space, Bottleneck Distance, Wasserstein Distances
Each barcode with n intervals can be encoded as (x 1 , d 1 , x 2 , d 2 , . . ., x n , d n ) where x i is the left endpoint of the i-th interval and d i its length.Since the ordering of the intervals does not matter, we consider the orbit space of the action of the symmetric group on n letters on the product ([0, ∞) × [0, ∞)) n given by permuting the coordinates.We denote it by B n .
The barcode space B is the quotient where ∼ is generated by equivalences of the form Before specifying the distance between two barcodes, we specify the distance between any pair of intervals, as well as the distance between any interval and the set of zero The distance between an interval and the set ∆ is Let B 1 = {I α } α∈A and B 2 = {J β } β∈B be barcodes.For finite sets A and B, and any bijection θ from a subset A ⊆ A to B ⊆ B, the penalty of θ, P ∞ (θ), is The bottleneck distance [12] is where the minimum is over all possible bijections from subsets of A to subsets of B.
There are other metrics also commonly used for barcode spaces.Setting the penalty for θ for p ≥ 1 to

Max-Plus Polynomials on the Barcode Space
In this section we find all max-plus polynomials that we can use as coordinates on the barcode space and prove that they are stable with respect to the bottleneck and Wasserstein distances.
The first step is to identify 2-symmetric max-plus polynomials on the image of B n → B. By abuse of notation we denote it simply by B n .It is the quotient of the following equivalence relation: two multisets of n intervals each, are equivalent if subsets A, B ⊆ {1, . . ., n} exist such that there is an equality of multisets with 0 persistence, i.e. d j = 0, then these functions are precisely the 2-symmetric max-plus polynomials whose restriction to W j is independent of x j for all j.
Then p restricted to W j is independent of x j if and only if a i j = 0 for all i = 1, . . ., m.
Proof.The direction (⇐) follows immediately.We must show (⇒).Choose j and assume that p restricted to W j is independent of x j .Suppose not all a i j are 0. Let i 0 be such that If this maximum is attained in more than one value, we choose the i 0 for which a i 0 is the biggest.Observe that p(0, . . ., 0, x j , 0, . . ., 0) = i=1...,m a i 0 x a i j j .If a i 0 j > 0, then p(0, . . ., 0, x j , 0, . . ., 0) = a i 0 0 Here we take the maximum over i for which a i 0 0 = a i 0 .For indices i when a i 0 0 = a i 0 , a i 0 0 + a i 0 j x j ≥ a i 0 + a i j x j for our choice of i 0 .This shows that for a i 0 j > 0 the max-plus polynomial p(x 1 , d 1 , . . ., x n , d n ) depends on x j .By assumption a i 0 j ≥ 0. The only way the expression does not depend on x j is if a i 0 j = 0.
Corollary 4.2.The subsemiring of max-plus polynomials whose restriction to W i is independent of x i for all i contains precisely the max-plus polynomials of the form We denote this semiring by D n .
Proposition 4.3.Let D Sn n denote the subring of elements of D n which are invariant under the action of S n .Then σ (0,1) , σ (0,1) 2 , . . ., σ (0,1) n generate D Sn n , in the sense that any element of D Sn n is of the form where a i 0 ∈ R and all b i j nonnegative integers.
Proof.According to Lemma 4.1 the 2-symmetric max-plus polynomials on B n are precisely symmetric max-plus polynomials in variables d 1 , . . ., d n .We can therefore apply Theorem 2.8 with σ (0,1) k playing the same role of σ k .Now that we have identified functions for each B n separately, we must assemble them to get functions on the barcode space.When n ≥ m, the natural inclusion . . .
Observe that Therefore i n n−1 are surjections for all positive integers n.We do not wish to include functions with infinitely many variables, such as max i∈N x i , and for this reason we take a filtered inverse limit of these objects instead of the inverse limit.The total degree is the filter we use.Recall that Deg p of a max-plus polynomial n−1 .We denote the inverse limit of this system by D k .The space of max-plus polynomials on the barcode space, D, is precisely Definition 4.4.A semiring (R, +, •) is called filtered if there exists such a family of subsemirings {R d } d∈N of (R, +, •) for operation + that Theorem 4.5.Max-plus polynomials on the barcode space, D, have the structure of a filtered semiring.They are generated by elements of the form σ (0,1) n , where n is a positive integer.

Stability of Max-Plus Polynomials
Stability is the key property that coordinate functions should satisfy.In this section we prove that the functions from D are stable with respect to the bottleneck and Wasserstein distances.
Theorem 5.1 (Bottleneck stability of max-plus polynomials).Let D be the filtered semiring of max-plus polynomials (see Theorem 4.5).
for any pair of barcodes B 1 and B 2 .
Lemma 5.2.For any pair of barcodes B 1 and B 2 and any n ∈ N, the difference between the total length of the longest n bars in B 1 and B 2 can be bounded from above by Without loss of generality assume that σ (0,1) n (B 1 ) ≥ σ (0,1) n (B 2 ).If n > l 1 or n > l 2 , we add 0 length intervals to B 1 , B 2 to achieve that their length is n.
Let θ be a bijection where the penalty is minimal, i.e.where some of these intervals might be 0 length intervals).Of course, we might have to relabel bars in B 2 for this to hold.Note that for those i, for which either d i or d i equals 0, we automatically have For all other 1 ≤ i ≤ n in this matching, By the definition of a minimal matching max i=1,...,m So we must only prove the first inequality.Notice that if ).The last inequality holds since n i=1 d i ≤ σ (0,1) n (B 2 ).Also note that we chose d 1 , . . ., d n in a way that σ (0,1) n (B 1 ) = n i=1 d i .
Proof of Theorem 5.1.Suppose F 1 and F 2 are such that C 1 and C 2 exist such that and for any any pair of barcodes B 1 and B 2 .
and similarly and by symmetry we conclude that Any function F from the filtered semiring of max-plus polynomials D is generated by taking maxima and sums of σ (0,1) n and constants.Since stability is preserved under these two operations and since σ (0,1) n are stable according to Lemma 5.2, F is also stable.Theorem 5.4 (Wasserstein stability of max-plus polynomials).Let D be the filtered semiring of max-plus polynomials.For F ∈ D and p ≥ 1, a constant C exists such that for any pair of barcodes B 1 and B 2 .
Note that for those i, for which either d i or d i equals 0, we automatically have For all other i in this matching, The first inequality holds since n i=1 d i ≤ σ (0,1) n (B 2 ).Also note that we chose d 1 , . . ., d n in a way that σ (0,1) 2 | p we use Hőlder's inequality.It follows from here that The statement of the theorem now follows from the same argument as in the proof of Theorem 4.5.

Tropical Rational Functions on the Barcode Space
While the the functions belonging to D are stable and can be used to assign vectors to barcodes, they do not separate points in the barcode space, because they are composed by taking sums and maxima of lengths of intervals and constants.One example is {(1, 2), (2, 2)} and {(2, 2), (3, 2)}.We can easily convince ourselves of this by evaluating σ (0,1) n on these barcodes.
Because there simply are not enough functions among max-plus polynomials to separate points, we expand the set of functions we observe to all tropical rational functions.Let Without loss of generality we assume that they are lexicographically ordered.
The tropical rational functions that respect the equivalence classes of B n , must respect the following equivalence relation ∼ on [0, ∞) 2n : We denote the semiring of such functions by R n .Theorem 6.1.No finite subset of R n exists which separates nonequivalent points in B n .
The function g is the L ∞ -distance between vectors (f 1 ( x), . . ., f m ( x)) and (f 1 ( x ), . . ., f m ( x )).Thus g( x, x ) = 0 if and only if x and x are equivalent points.
Since |x| = max(x, −x), g is a tropical rational function and as demonstrated in Subsection 2.2 we can write g( x, x ) as max i=1,...,l 1 For any x ≥ 0, define p x = (x, 0, . . ., x, 0).Since p x and p y are equivalent for any x, y ≥ 0 with respect to the relation defined before the statement of Theorem 6.1, g( p x , p y ) = 0 and consequently max i=1,...,l 1 s k,j + u j ) are piecewise linear functions defined on R 2 .Each function defines a decomposition of R 2 into maximal closed domains over which this function is linear on every domain (Lemma 2.5).Let s k,j + u j for all j = i}.
If A is in the interior (relative to P ) of some S i ∩ T j ∩ P , then we can clearly find the required and a.If A is in a boundary, consider what lies in the direction v.If it is the interior of some S i ∩ T j ∩ P , then A is in S i ∩ T j ∩ P , and we can again find suitable and a. Suppose now that A lies in a boundary which continues in the direction of v.
Let be small enough that does not yet end at v, and such that the line segment open at A joining A and A + v does not intersect any boundaries other than ; we then let B = A + v. Since this boundary did not yet end at B, the vector w with the origin point in B must point into the interior of some S i ∩ T j ∩ P ; choose a small enough a so that C = B + a w, and indeed the line segment joining B and C lies within S i ∩ T j ∩ P .Now we calculate 0 = g((0, , . . ., ) + u j ) = g((0, , . . ., 0, ), (a, , . . ., a, )) = 0, which is a contradiction.Theorem 6.1 states that no finite subset of symmetric min-plus, max-plus or tropical rational functions exists that separates barcodes.In this section we identify a countable set of tropical rational functions on the barcode space that does.Theorem 6.3.Let {σ (e 1,1 ,e 1,2 ),...,(e n,1 ,e n,2 ) } be the set of elementary 2-symmetric max-plus polynomials from Definition 2.10.Functions, defined by E m,(e 1,1 ,e 1,2 ),...,(e n,1 ,e n,2 ) (x 1 , d 1 , . . ., x n , d n ) := σ (e 1,1 ,e 1,2 ),...,(e n,1 ,e n,2 ) (x for m ∈ N are contained in R n .Furthermore, they separate nonequivalent points in B n .
Therefore we see that for this choice of m and this e, and we are done.
It is hard to characterize all tropical rational functions on B n , so we work with a subsemiring of functions obtained by taking maxima, adding and substracting functions from {E m,(e 1,1 ,e 1,2 ),...,(e n,1 ,e n,2 ) }.We denote this subsemiring by G n or G Sn n when we wish to stress that all the functions contained in it are symmetric.We have restriction maps i n,m : G n → G m , when n ≥ m, induced by Here p = n − l − k − j.Therefore we i n,n−1 is a surjection from G n to G n−1 and we may construct composites We cannot proceed as we did in the case of max-plus polynomials, since we cannot define a degree of a tropical rational expression.However, recall that according to Section 2.1 we can write any r ∈ G n as max i=1,...,l 1 , p, q are max-plus polynomials with deg p, deg q ≤ k} n−1 .We denote the inverse limit of this system by G k .Let G = ∪ ∞ k=1 G k .Theorem 6.7.Tropical rational functions in G form a filtered semiring and they separate points in the barcode space.As a semiring G is generated by elements of the form E m,(1,0) k (0,1) l (1,1) p where k, l, p are nonnegative integers and m is a positive integer.

Stability of Tropical Rational Functions in G
In this subsection we prove that the rational functions that we identified are stable with respect to the bottleneck and Wasserstein distances.
for any pair of barcodes B 1 and B 2 .
Lemma 7.2.Let m ∈ N, m i = min{x i , md i } and m i = min{x i , md i }.Then Proof.If x i ≤ md i and x i ≤ md i , then If x i ≥ md i and x i ≥ md i , then Let x i ≤ md i and x i > md i (the case when x i > md i and x i ≤ md i is analogous).Since 0 On the other hand −x i < −md i ≤ 0 and consequently It follows that and consequently By triangle inequality Finally these two inequalities imply If l 1 , l 2 < p + k + l, we add 0 length intervals to both barcodes.
Let θ be a bijection where the penalty is minimal, i.e.where P ∞ (θ) = d ∞ (B 1 , B 2 ).Assume that θ matches (x 1 , d 1 ) with (x 1 , d 1 ), (x 2 , d 2 ) with (x 2 , d 2 ), . . ., (x p+k+l , d p+k+l ) with (x p+k+l , d p+k+l ).Recall that for all i in this matching, Let's also check what happens if d i = 0.In this case, (x i , d i ) is matched to a 0 length barcode and Let M = max{1, m}.Using Lemma 7.2 and the above inequalities This proves that E is Lipschitz.In Proof of Theorem 5.1 we showed that stable functions on the barcode space are preserved under taking sums, maxima and minima.Since E m,(e 1,1 ,e 1,2 ),...,(e n,1 ,e n,2 ) are stable as any F ∈ G is composed of taking sums, maxima and minima of E m,(e 1,1 ,e 1,2 ),...,(e n,1 ,e n,2 ) .

Theorem 7.3 (Wasserstein stability of functions in G
for any pair of barcodes B 1 and B 2 . Proof.We denote the function E m,(0,1) and If l 1 , l 2 < p + k + l, we add 0 length intervals to both barcodes.
Let θ be a bijection where the penalty is minimal, i.e.where P ∞ (θ) = d q (B 1 , B 2 ).Assume that θ matches (x 1 , d 1 ) with (x 1 , d 1 ), (x 2 , d 2 ) with (x 2 , d 2 ), . . ., (x p+k+l , d p+k+l ) with (x p+k+l , d p+k+l ).Recall that for all i in this matching, Let M = max{1, m}.Using Lemma 7.2 and the above inequalities, we get: The first inequality holds since p i=1 (m i + d i ) + p+k i=p+1 m i + p+k+l i=p+k+1 d i ≤ E(B 2 ).The last inequality uses Hőlder's inequality.Taking the q-th root finishes the proof.
We conclude that E is Lipschitz.In Proof of Theorem 5.1 we showed that stable functions on the barcode space are preserved under taking sums, maxima and minima.Since E m,(e 1,1 ,e 1,2 ),...,(e n,1 ,e n,2 ) are stable, F ∈ G is also stable as it is composed of taking sums, maxima and minima of E m,(e 1,1 ,e 1,2 ),...,(e n,1 ,e n,2 ) .

Classifying Digits with Tropical Coordinates
Adcock et al. [1] used polynomial coordinates to classify digits from the MNIST database [23] of handwritten digits.In this section we compare classification results they obtained with mine, which were classified using tropical coordinates.Aaron Adcock provided the matlab code needed to convert digital images into filtrations.
While homology itself cannot distinguish between the digits -1, 5, and 7 never have loops, 0, 6, 9 always have loops, 8 has two loops, while 2, 3, 4 might or might not have loops, depending on style -we can use persistent homology as a measurement of shape.Figure 1 shows the first 100 digits of the database.The original black and white images Following Collins et al. [13], we first threshold (setting pixel values greater than 100 to 1 and the rest to 0) to produce a binary image.We construct four filtrations as follows.
For each pixel we add a vertex, for any pair of adjacent pixels (diagonals included) an edge and for any triple of adjacent pixels a 2-simplex.We sweep across the rows from the left and the right and across the columns from top to bottom and vice versa.This adds spatial information into what would otherwise be a purely topological measurement.We take both Betti 0 and Betti 1.
This extra spatial information reveals the location of various topological features.For example, though a '9' and '6' both have one connected component and one loop, the loop will appear at different locations in the 1-dimensional homology top-down sweep for the '9' and '6' (see Figure 3).In digits with no loops 0-dimensional homology right to left sweep distinguishes '3' from other digits (see Figure 2).We can use different methods for turning barcodes into vectors.Adcock et al. selected four features, i (y i − x i ) 4 i (y max − y i ) 2 (y i − x i ) 4  which when applied to the four sweeps, each with a 0-dimensional and 1-dimensional barcode, gives a feature vector of total size 32.We used command fitcecoc in matlab to get an error-correcting output codes (ECOC) multiclass model [25].This model was trained using support vector machine (SVM) [14].We obtained the best results using the Gaussian kernel.As is typical when using a SVM, we scaled each coordinate such that the values were between 0 and 1.To measure the classification accuracy we used 100-fold   i d i i min(28d i , x i ) i (max i (min(28d i , x i ) + d i ) − (min(28d i , x i ) + d i )) yields slightly better results (see Table 2).Note that we used many functions involving 1000 digits 5000 digits 10000 digits 87.70% 91.36% 92.41% Table 2: Classification accuracy using max-plus type coordinates.
sums of lengths of intervals.These yielded the best results, which is perhaps not surprising since when using persistent homology and interpreting the barcode, we assign importance to features depending on over what range of parameters they persist.
This method just demonstrates how one can use persistent homology with other machine learning algorithms and does not outperform existing classification algorithms.Figure 4 shows examples of digits that were not correctly classified.The most common confusion is between a '5' and a '2' written with no loop.Other common confusions occur when topological changes occurred to the digit, for example when '8' is written with no loops, etc.
These examples also show the power of combining topology with geometry, and in particular demonstrate how coordinates can serve as a method for organizing the collection of all barcodes, and therefore any database whose members produce barcodes.They are also stable with respect to the bottleneck and Wasserstein distances.

a
⊕ b := min (a, b) and a b := a + b.

Definition 2 . 3 .
Min-plus polynomials are the semiring of equivalence classes of min-plus polynomial expressions with respect to functional equivalence relation ∼.In the case of n variables we denote the semiring by MinPlus[x 1 , x 2 , . . ., x n ].

Theorem 7 . 1 (
Bottleneck stability of functions in G

Figure 1 :
Figure 1: The first 100 images of the MNIST database.

Table 1 :
Classification accuracy using ordinary polynomial coordinates.Using the following max-plus type coordinatesmax i d i max i<j (d i + d j ) max i<j<k (d i + d j + d k ) max i<j<k<l (d i + d j + d k + d l )