Persistence Diagram Principal Geodesic Analysis¶
Pipeline description¶
This example first loads an ensemble of scalar fields within a cinema database from disk. Then, the PersistenceDiagram is computed on each scalar field.
All these diagrams are passed to MergeTreePrincipalGeodesics to compute Principal Geodesic Analysis (PGA) in the metric space of persistence diagrams.
Then the filter MergeTreePrincipalGeodesicsDecoding is used to reconstruct the input diagrams, to sample evenly diagrams along the principal geodesics and to sample a discrete grid of persistence diagrams of the PGA basis.
A distance matrix is then computed with MergeTreeDistanceMatrix with the diagrams of the grid. This distance matrix is used as input of DimensionReduction to compute a MultiDimensional Scaling (MDS), performing a dimensionality reduction in 3D, thus representing the Wasserstein metric space as a curved surface (top right view, using the PointSetToSurface module). A planar representation of the ensemble is also available (bottom, using the ProjectionFromTable module from the PGA coefficients).
In terms of visualisation, a scalar field of each cluster is displayed. The original diagrams are displayed alongside their reconstruction on their right. The persistence pairs of the diagrams are colored by ID to see what features they correspond to in the scalar field.
The 3D and 2D surfaces are displayed with the persistence correlation view on the right. The 12 scalar fields are colored by Cluster ID.
The python script computes the PD-PGA and saves the resulting coefficients of the input diagrams.
ParaView¶
To reproduce the above screenshot, go to your ttk-data directory and enter the following command:
paraview --state=states/persistenceDiagramPGA.pvsm
Python code¶
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
|
To run the above Python script, go to your ttk-data directory and enter the following command:
pvpython python/persistenceDiagramPGA.py
Inputs¶
- Isabel.cdb: a cinema database containing 12 regular grids.
Outputs¶
PD-PGA_coef.csv
: the coefficients of the input diagrams corresponding to their coordinates in the PGA basis.