pulsatrix 1.1.0
Loading...
Searching...
No Matches
rtd.hpp
Go to the documentation of this file.
1
15#pragma once
16
17#include <cstdint>
18#include <vector>
19
22#include "pulsatrix/tensor.hpp"
23
24namespace pulsatrix {
25
41[[nodiscard]] PersistenceDiagram CrossBarcode(const DistanceMatrix& w, const DistanceMatrix& w_tilde, int dimension = 1);
42
44struct RtdOptions {
46 int64_t sample_size = 500;
48 int64_t trials = 10;
50 uint32_t seed = 0;
51};
52
54struct RtdResult {
56 double rtd = 0;
58 double rtd_ab = 0;
60 double rtd_ba = 0;
62 int64_t trials = 0;
63};
64
75[[nodiscard]] RtdResult Rtd(const Tensor& a, const Tensor& b, const RtdOptions& options = {});
76
84
88 double cka = 0;
91 double mutual_knn = 0;
94};
95
103 const RepresentationComparisonOptions& options = {});
104
105} // namespace pulsatrix
N-dimensional tensor. Owns its data buffer exclusively; a DeviceBackend* is injected (not owned) – th...
Definition tensor.hpp:29
Pairwise Euclidean distances of a point cloud, computed with one GEMM on any backend,...
Definition acquisition_functions.hpp:16
PersistenceDiagram 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,...
RtdResult Rtd(const Tensor &a, const Tensor &b, const RtdOptions &options={})
Representation Topology Divergence between two representations of the same inputs (the paper's Algori...
RepresentationComparison 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 inform...
A persistence diagram: the features of one homology dimension, each born at one scale and dying at a ...
The distances between every pair of n points, condensed.
Definition distance_matrix.hpp:56
The features of one homology dimension: H0 for components, H1 for loops, H2 for voids.
Definition persistence_diagram.hpp:32
CompareRepresentations()'s settings.
Definition rtd.hpp:78
int64_t k
Neighbors for the mutual-kNN alignment.
Definition rtd.hpp:80
RtdOptions rtd
RTD's batches.
Definition rtd.hpp:82
Three views of how alike two representations are.
Definition rtd.hpp:86
RtdResult rtd
RTD: differences in clusters and loops across scales; 0 is identical.
Definition rtd.hpp:93
double mutual_knn
Mutual-kNN alignment: the share of each input's k nearest neighbors the two agree on; chance is about...
Definition rtd.hpp:91
double cka
Debiased linear CKA: the whole geometry, up to rotation and scale; 1 is identical.
Definition rtd.hpp:88
Rtd()'s settings: the paper's Algorithm 2.
Definition rtd.hpp:44
uint32_t seed
The random seed for the batches; the same on every platform.
Definition rtd.hpp:50
int64_t sample_size
Points per random batch; with fewer points than this, all of them, once.
Definition rtd.hpp:46
int64_t trials
How many batches to average.
Definition rtd.hpp:48
Rtd()'s result.
Definition rtd.hpp:54
double rtd_ba
RTD(b, a).
Definition rtd.hpp:60
double rtd
The symmetric score, (RTD(a, b) + RTD(b, a)) / 2, averaged over the batches.
Definition rtd.hpp:56
double rtd_ab
RTD(a, b) alone: the total H1 length of CrossBarcode(w_a, w_b), averaged.
Definition rtd.hpp:58
int64_t trials
The batches used.
Definition rtd.hpp:62
N-dimensional tensor – owns a buffer via DeviceBackend*, RAII (Rule of Five).