Skip to content

scaleNormalizedStress

function scaleNormalizedStress(m): MetricResult;

Defined in: metrics/distance.ts:82

Stress after rescaling the projection to fit as well as it can.

The scale-free version of stress: it answers “is the shape right”, ignoring the projection’s arbitrary units. Almost always the one you want when comparing methods.

  • Needs: high-dimensional data and projection. No labels.
  • Range: [0, 1], lower is better; 0 is a perfect match up to a global scale. Substituting the optimal α gives 1 - sumHL²/(sumLL·sumHH) under the root, so the value cannot exceed 1 — α = 0 is always available and already scores 1.
  • Cost: O(1), from an O(N²·D) pass.
ParameterType
mDistanceMoments

MetricResult

import { analyze, stress, scaleNormalizedStress } from "@saehrimnir/sickle";
const a = analyze(data, projection);
stress(a.moments).value; // 0.0807 — punishes a wrong overall scale
scaleNormalizedStress(a.moments).value; // 0.0737 — the shape alone