Skip to content

tripletAccuracy

function tripletAccuracy(s): MetricResult;

Defined in: metrics/structure.ts:137

Share of point triples whose relative ordering survives the projection.

For every anchor and every pair of other points, does the nearer one stay nearer? Purely ordinal, so it ignores scale entirely, and it reaches across the whole dataset rather than a k-neighbourhood — the best single check that global arrangement is right.

  • Needs: high-dimensional data and projection. No labels.
  • Range: [0, 1], higher is better. 0.5 is chance, so read that as the floor.
  • Cost: O(1), from an O(N² log N) pass given triplets: true.

Every triple is counted exactly; this is not a sample, so it has no seed and no run-to-run variation. Per-point values give each anchor’s own accuracy.

ParameterType
sStructureMoments

MetricResult

Wang, Huang, Rudin & Shaposhnik, JMLR 22 (2021) https://jmlr.org/papers/v22/20-1061.html

import { analyze, tripletAccuracy } from "@saehrimnir/sickle";
const a = analyze(data, projection, { triplets: true });
tripletAccuracy(a.structure).value; // 0.956 — 0.5 is a coin flip