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
rnxto remove that dependence. - Cost: O(1), from an O(N² log N) pass.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
cr | CoRanking |
k | number |
Returns
Section titled “Returns”number
Example
Section titled “Example”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 scoresrnx(a.coRanking, 20); // 0.5172 — the same quantity, chance subtracted