Skip to content

silhouette

function silhouette(ldIn, cl): MetricResult;

Defined in: metrics/separability.ts:130

How much closer each point is to its own class than to the nearest other class.

The standard cluster-quality measure. Reads the picture only, so it says whether the classes look separated — not whether that separation is real. A projection that invents clean clusters scores well here.

  • Needs: projection only. Labels required.
  • Range: [-1, 1], higher is better. Above ~0.5 is well separated; near 0 means classes overlap; negative means points sit closer to another class than their own.
  • Cost: O(N²·D).

Per-point values are the classic silhouette scores and average to the total.

ParameterType
ldInPointsInput
clClusters

MetricResult

Rousseeuw, J. Comput. Appl. Math. 20 (1987) https://doi.org/10.1016/0377-0427(87)90125-7

import { clusters, silhouette } from "@saehrimnir/sickle";
const cl = clusters(projection, labels); // takes a Clusters, not raw labels
silhouette(projection, cl).value; // 0.8838 — PCA of 4 gaussian blobs
// the same labels on a random projection: -0.049, i.e. classes overlap