Skip to content

qnx

function qnx(cr, k): number;

Defined in: metrics/neighborhood.ts:186

Fraction of each point’s k nearest neighbours that survive the projection.

The rawest neighbourhood measure: no correction, no weighting.

  • Needs: high-dimensional data and projection. No labels.
  • Range: [0, 1], higher is better. Note the floor rises with k — a random projection scores about k/(N-1), so values are only comparable at equal k and N. Use rnx to remove that dependence.
  • Cost: O(1), from an O(N² log N) pass.
ParameterType
crCoRanking
knumber

number

import { analyze, qnx, rnx } from "@saehrimnir/sickle";
const a = analyze(data, projection); // number[][] straight in
qnx(a.coRanking, 20); // 0.5657 — but a random projection already scores
rnx(a.coRanking, 20); // 0.5172 — the same quantity, chance subtracted