# Human Body Shapes Anomaly Detection and Classification Using Persistent Homology
## 2 Methodology
### Persistence Diagrams, Landscapes, Silhouettes and Distances  
Persistent homology is a tool used to efficiently compute and encode the multidimensional homological features of topological spaces associated to a dataset. To compute these homological invariants, we have to build topological structures on the data such as filtered simplicial complexes. A simplex is a notion generalizing points, line segments, triangles and tetrahedrons to any dimension and composed of faces that are also simplices of lower dimension. A simplicial complex \(K\) is a collection of simplices satisfying two properties: each face of a simplex of \(K\) is in \(K\) and the non-empty intersection of two simplices of \(K\) is a face of both of them. Given a body point cloud \(X\) in \(\mathbb{R}^{3}\), several types of simplicial complexes can be constructed on \(X\), such as the Vietoris-Rips and the Cech complexes. We center three-dimensional balls of radius \(\epsilon\) on each data point, and we vary \(\epsilon\) from 0 to \(+\infty\). The data points are considered as 0-simplices, and when \(n+1\) balls intersect, we add an \(n\)-dimensional face between them. The result is called a Cech complex. For each fixed \(\epsilon\), we count the homological features of the associated topological space. Since the underlying vector space is of dimension 3, we have three types of homological classes to consider:  
* \(H_{0}\): The connected components;
* \(H_{1}\): The non-homotopic loops;
* \(H_{2}\): The two-dimensional voids. Thus, we represent each homological feature by a point in \(\mathbb{R}^{2}\), where its abscissa is the birth time of the feature and its ordinate is the death time. The set of points obtained in this way is the persistence diagram of \(X\). The persistence barcode represents each homology class with a bar defined by its birth time, when the topological feature appears, and a death time, when the topological feature disappears. In order not to have too many points due to the creation and death of small homological features, a minimal persistence is fixed. For example, in Figure 2, the persistence barcode and diagram of the individual S0013 (Figure 1) are given. Figure 1: The mesh of the individual S0013. It is possible to compare persistence diagrams using the Wasserstein distance. Let \(D\) and \(D^{\prime}\) be persistence diagrams. A perfect matching between \(D\) and \(D^{\prime}\) is a subset \(\phi\subseteq D\times D^{\prime}\) such that every point of \(D\) and \(D^{\prime}\) is exactly one time in \(\phi\), completing with the diagonal if necessary in order to ignore cardinality mismatches. The \((p,q)\)-Wasserstein distance between \(D\) and \(D^{\prime}\) is defined by  
\[W_{p,q}(D,D^{\prime})=\underset{\phi\in\Phi}{inf}\big{(}\sum_{x\in D}||x-\phi( x)||_{q}^{p}\big{)}^{1/p}, \tag{1}\]  
where \(||x||_{q}\) is the \(q\)-norm of \(x\) defined by  
\[||x||_{q}=\big{(}\sum|x_{i}|^{q}\big{)}^{1/q}. \tag{2}\]  
We exclusively use the \((2,2)\)-Wasserstein distance. For precise definitions and details, see [8; 9]. Persistence landscapes are an encoding of persistence diagrams by series of piecewise continuous linear functions [25; 26]; see Figure 3. This allows us to perform statistics on them, the absence of which was a disadvantage of persistence diagrams. In particular, it is possible to calculate unique averages of landscapes. While a persistence landscape has a corresponding persistence diagram, an average of persistence landscapes does not. A persistence silhouette is computed by taking a weighted average of the collection of \(1\)D-piecewise-linear functions given by the persistence landscapes and then by evenly sampling this average on a given range. Finally, the correspo  
Figure 3: Visual explanation of persistence landscapes. The persistence diagram (**left**) is tilted so that the diagonal becomes the new horizontal axis (**top right**). The \(\lambda_{i}\) are the piecewise linear functions (**bottom right**). Figure 2: The persistence diagram and barcode of S0013.