wassersteinH0
function wassersteinH0( a, b, p?): number;Defined in: metrics/topology.ts:169
Wasserstein-p distance between two degree-0 diagrams — total mismatch rather than the worst one, so it responds to many small differences where the bottleneck distance does not.
Parameters
Section titled “Parameters”| Parameter | Type | Default value |
|---|---|---|
a | ArrayLike<number> | undefined |
b | ArrayLike<number> | undefined |
p | number | 1 |
Returns
Section titled “Returns”number
Example
Section titled “Example”import { persistenceH0, wassersteinH0 } from "@saehrimnir/sickle";
const a = persistenceH0(data), b = persistenceH0(projection);
wassersteinH0(a.deaths, b.deaths, 1); // 234.7026 — sums every discrepancywassersteinH0(a.deaths, b.deaths, 2); // 15.4333// Unlike the bottleneck distance, this notices many small differences.