Skip to content

dunnIndex

function dunnIndex(ldIn, cl): MetricResult;

Defined in: metrics/labelled.ts:199

Smallest centroid-to-centroid gap divided by the widest class.

Not the textbook Dunn index. The classic definition uses the minimum distance between any two points of different classes; this uses the distance between class centroids, which is far more robust to a single stray point. The denominator is the classic one: the largest within-class point-pair distance, so the measure is still volatile from below.

  • Needs: projection only. Labels required.
  • Range: [0, ∞), higher is better. Above 1 means classes are further apart than they are wide.
  • Cost: O(N²·D).
ParameterType
ldInPointsInput
clClusters

MetricResult

Dunn, J. Cybernetics 3 (1973) https://doi.org/10.1080/01969727308546046

import { clusters, dunnIndex } from "@saehrimnir/sickle";
const cl = clusters(projection, labels);
dunnIndex(projection, cl).value; // 2.6938 — unbounded, higher is better