This is a library that provides an implementation of isometric-seriation-based dimensionality reduction techniques, from the paper "IsilDR – Isometric‑Seriation‑Based Dimensionality Reduction for Visual Cluster Analysis".
While all dimensionality techniques produce distortions, false- and missing neighbors --- Points which are neighbors in the input data but not in the projection or vice versa. Until now, only orthogonal linear projection techniques like PCA are producing exclusivly false neighbors, while other techniques like t-SNE or UMAP produce both types of distortions. With IsilDR we have now a new class of dimensionality reduction techniques which only produce missing neighbors.
IsilDR has the false-neighbor-free property because in the projection all distances are guaranteed either equal or bigger than in the input data.
You can find the Visual Cluster Analysis tool here: https://github.com/saehm/IsilDR_VCA_tool.
| Technique | Description | API |
|---|---|---|
| HilDR | A Hilbert‑curve based ordering of points. | hildr1d, hildr |
| GSP | Greedy shortest‑path (nearest‑neighbor) ordering. | gsp1d, gsp |
| RIsilDR | Random ordering (controlled by a seed). | risildr1d, risildr |
All three techniques expose the same output shape: an array of objects containing (at least)
d– cumulative distance from the start pointi– original index of the point in the input arraydist– distance to the previous point in the ordering
npm install @saehrimnir/isildrThe library ships as an ES module (dist/isildr.es.js) and a UMD bundle (dist/isildr.umd.js). Import the API you need:
import { hildr, gsp, risildr } from "@saehrimnir/isildr";All functions accept a 2D array X where each row is a point.
| Function | Parameters | Returns |
|---|---|---|
hildr1d(X, b, order?, type?) |
b: Hilbert level, order: order of dimensions: type: take the "full" or "subspace" approach (details can be found in the paper) |
{h: BigInt, i: number, d: number, dist: number}[] |
hildr(X, b, orders, type?) |
orders: array of orderings, also defines the output dimensionality |
{h: BigInt, i: number, d: number, dist: number}[][] |
gsp1d(X, start?) |
start: index of starting point |
{i: number, d: number, dist: number}[] |
gsp(X, starts) |
starts: array of starting point indices, also defines the output dimensionality |
{i: number, d: number, dist: number}[][] |
risildr1d(X, seed?) |
seed: seed for the random number generator |
{i: number, d: number, dist: number}[] |
risildr(X, seeds) |
seeds: array of seeds, also defines the output dimensionality |
{i: number, d: number, dist: number}[][] |
For more details on the parameters and internal logic, consult the source files in src/.
import { hildr1d, gsp1d, risildr1d } from "@saehrimnir/isildr";
// Sample 2D data (e.g., 10 random points)
const data = Array.from({ length: 10 }, () => [
Math.random() * 100,
Math.random() * 100,
]);
// 1D Hilbert projection
const hilbert = hildr1d(data, 5); // b = 5 (Hilbert level)
// 1D Greedy shortest path projection
const gsp = gsp1d(data);
// 1D Random projection with seed 42
const random = risildr1d(data, 42);
// All outputs are arrays of objects sorted by original index
console.log(hilbert[0]); // for example { h: 3n, d: 0, i: 0, dist: 0 }
console.log(gsp[3]); // for example { d: 23.4, i: 3, dist: 5.2 }