pulsatrix 1.1.0
Loading...
Searching...
No Matches
rtd.hpp File Reference

Representation Topology Divergence (RTD): how differently two representations of the same inputs are shaped, cluster by cluster and loop by loop, and CompareRepresentations(), one report with CKA, mutual-kNN alignment and RTD side by side. More...

#include <cstdint>
#include <vector>
#include "pulsatrix/tda/distance_matrix.hpp"
#include "pulsatrix/tda/persistence_diagram.hpp"
#include "pulsatrix/tensor.hpp"
Include dependency graph for rtd.hpp:

Go to the source code of this file.

Classes

struct  pulsatrix::RtdOptions
 Rtd()'s settings: the paper's Algorithm 2. More...
 
struct  pulsatrix::RtdResult
 Rtd()'s result. More...
 
struct  pulsatrix::RepresentationComparisonOptions
 CompareRepresentations()'s settings. More...
 
struct  pulsatrix::RepresentationComparison
 Three views of how alike two representations are. More...
 

Namespaces

namespace  pulsatrix
 

Functions

PersistenceDiagram pulsatrix::CrossBarcode (const DistanceMatrix &w, const DistanceMatrix &w_tilde, int dimension=1)
 The R-Cross-Barcode in one dimension: the Rips diagram of the 2n-vertex graph with distances, for points A_1..A_n and copies A'_1..A'_n (the paper's practical form, its Equation 1 with the extra vertex O folded in):
 
RtdResult pulsatrix::Rtd (const Tensor &a, const Tensor &b, const RtdOptions &options={})
 Representation Topology Divergence between two representations of the same inputs (the paper's Algorithm 2): in each batch, Euclidean distances within a and within b, each divided by its 0.9 quantile so that scale doesn't count, then the total H1 length of both cross-barcodes.
 
RepresentationComparison pulsatrix::CompareRepresentations (const Tensor &a, const Tensor &b, const RepresentationComparisonOptions &options={})
 CKA, mutual-kNN alignment and RTD of the same two representations, for a report: they disagree informatively, as when CKA is high but RTD isn't 0 because one layer splits a cluster the other keeps whole.
 

Detailed Description

Representation Topology Divergence (RTD): how differently two representations of the same inputs are shaped, cluster by cluster and loop by loop, and CompareRepresentations(), one report with CKA, mutual-kNN alignment and RTD side by side.

CKA compares two representations' whole geometry at once, and can score two layers as similar when one has clusters or loops the other lacks. RTD (Barannikov, Trofimov, Balabin and Burnaev, ICML 2022) compares their topology at every scale. Build the Vietoris-Rips filtration of a graph on two copies of the inputs, whose distances mix both representations; its barcode, the R-Cross-Barcode, records the features one representation has at a scale where the other has already lost them. RTD is the total length of its H1 bars. It is 0 for identical representations, and grows with every cluster that merges at a different scale.