Skip to content

distanceConsistency

function distanceConsistency(ldIn, cl): MetricResult;

Defined in: metrics/separability.ts:253

Fraction of points lying nearest their own class centroid.

A blunt but very readable measure: “what share of the plot is on the right side of the boundaries”. Being centroid-based, it is blind to class shape — two interleaved crescents with the same centre score badly even if perfectly drawn.

  • Needs: projection only. Labels required.
  • Range: [0, 1], higher is better. The chance level is roughly 1/number of classes.
  • Cost: O(N·k·D) for k classes.
ParameterType
ldInPointsInput
clClusters

MetricResult

Sips, Neubert, Lewis & Hanrahan, Computer Graphics Forum 28 (2009) https://doi.org/10.1111/j.1467-8659.2009.01467.x

import { clusters, distanceConsistency } from "@saehrimnir/sickle";
const cl = clusters(projection, labels);
distanceConsistency(projection, cl).value; // 1 — every point nearest its own centroid
// Chance is about 1 / number of classes, so 0.25 here, not 0.