Shared TypeScript types and runtime validators for Distortion-aware brushing datasets.
Use this package when you need to check that raw HD/LD input or a preprocessed DAB dataset has the shape expected by @dabrush/preprocess-js, @dabrush/engine, and @dabrush/web.
yarn add github:distortion-aware-brushing/schema#main
# or
npm install github:distortion-aware-brushing/schema#mainThe package is not published to npm yet. GitHub installation runs the package prepare script and builds dist/ locally during install.
Raw input is just high-dimensional data and low-dimensional coordinates with aligned rows.
import type { DabRawInput } from "@dabrush/schema";
const raw: DabRawInput = {
hd: [
[0.1, 0.2, 0.3],
[0.8, 0.1, 0.4]
],
ld: [
[120, 300],
[180, 260]
],
labels: ["a", "b"],
features: ["f0", "f1", "f2"]
};hd must be n x m. ld must be n x 2. This project does not create projections; PCA, UMAP, or t-SNE should happen before DAB preprocessing.
After preprocessing, a DabDataset adds SNN similarity in CSR format plus a KNN graph.
import type { DabDataset } from "@dabrush/schema";
type Dataset = DabDataset;Similarity values are defined as “larger means closer.” In v0, similarity.format is always "csr" and similarity.metric is "snn".
import { assertRawInput, validateDabDataset, validateRawInput } from "@dabrush/schema";
const result = validateRawInput(raw);
if (!result.ok) {
console.error(result.errors);
}
assertRawInput(raw); // throws when invalid
const datasetResult = validateDabDataset(dataset);Use validate* when you want error lists, and assert* when throwing is the right control flow.
DabRawInputDabDatasetCsrSimilarityNumericMatrixvalidateRawInput(input)assertRawInput(input)validateDabDataset(dataset)assertDabDataset(dataset)DAB_SCHEMA_VERSION