Skip to content

@saehrimnir/druidjs

Clustering

ClassDescription
CURECURE (Clustering Using REpresentatives)
HierarchicalClusteringHierarchical Clustering
KMeansK-Means Clustering
KMedoidsK-Medoids (PAM - Partitioning Around Medoids)
MeanShiftMean Shift Clustering
OPTICSOPTICS (Ordering Points To Identify the Clustering Structure)
XMeansX-Means Clustering

Data Structures

ClassDescription
DisjointSet-
Heap-

Dimensionality Reduction

ClassDescription
FASTMAPFastMap algorithm for dimensionality reduction.
ISOMAPIsomap (Isometric Mapping)
KKMDSKamada-Kawai Multidimensional Scaling (KKMDS)
LDALinear Discriminant Analysis (LDA)
LLELocally Linear Embedding (LLE)
LocalMAPLocalMAP
LSPLeast Square Projection (LSP)
LTSALocal Tangent Space Alignment (LTSA)
MDSClassical Multidimensional Scaling (MDS)
MINFOTreeMinimum Information Trees (MINFO Trees)
PaCMAPPairwise Controlled Manifold Approximation Projection (PaCMAP)
PCAPrincipal Component Analysis (PCA)
SAMMONSammon's Mapping
SMACOFMetric Multidimensional Scaling (MDS) via SMACOF.
SQDMDSSQuadMDS (Stochastic Quartet MDS)
StressMDSWeighted metric MDS (stress majorization family)
TopoMapTopoMap
TriMapTriMap
TSNEt-SNE (t-Distributed Stochastic Neighbor Embedding)
UMAPUniform Manifold Approximation and Projection (UMAP)

KNN

ClassDescription
AnnoyAnnoy-style (Approximate Nearest Neighbors Oh Yeah) implementation using Random Projection Trees.
BallTreeBall Tree for efficient nearest neighbor search.
HNSWHierarchical Navigable Small World (HNSW) graph for approximate nearest neighbor search.
KDTreeKD-Tree (K-dimensional Tree) for efficient nearest neighbor search.
LSHLocality Sensitive Hashing (LSH) for approximate nearest neighbor search.
NaiveKNNNaive KNN implementation performing an exhaustive scan.
NNDescentNN-Descent

Linear Algebra

FunctionDescription
inner_product-
qrComputes the QR Decomposition of the Matrix A using Gram-Schmidt process.
qr_householderComputes the QR Decomposition of the Matrix A with householder transformations.
simultaneous_poweriterationComputes the k biggest Eigenvectors and Eigenvalues from Matrix A with the QR-Algorithm.

Matrix

NameDescription
Matrix-
distance_matrixComputes the distance matrix of datamatrix A.
k_nearest_neighborsComputes the k-nearest neighbors of each row of A.
linspaceCreates an Array containing number numbers from start to end. If number = null.
normComputes the norm of a vector, by computing its distance to 0.
normalizeNormalizes Vector v.

Metrics

FunctionDescription
bray_curtisComputes the Bray-Curtis distance between a and b.
canberraComputes the canberra distance between a and b.
chebyshevComputes the chebyshev distance (L) between a and b.
cosineComputes the cosine distance (not similarity) between a and b.
euclideanComputes the euclidean distance (l_2) between a and b.
euclidean_squaredComputes the squared euclidean distance (l_2^2) between a and b.
goodman_kruskalComputes the Goodman-Kruskal gamma coefficient for ordinal association.
hammingComputes the hamming distance between a and b.
haversineComputes the Haversine distance between two points on a sphere of unit length 1. Multiply the result with the radius of the sphere. (For instance Earth's radius is 6371km)
jaccardComputes the jaccard distance between a and b.
manhattanComputes the manhattan distance (l_1) between a and b.
sokal_michenerComputes the Sokal-Michener distance between a and b.
wassersteinComputes the 1D Wasserstein distance (Earth Mover's Distance) between two distributions.
yuleComputes the yule distance between a and b.

Numerical

FunctionDescription
kahan_sumNumerical stable summation with the Kahan summation algorithm.
neumair_sumNumerical stable summation with the Neumair summation algorithm.

Optimization

FunctionDescription
powell-

Other

NameDescription
EigenArgs-
ParametersAnnoy-
ParametersBallTree-
ParametersCURE-
ParametersFASTMAP-
ParametersHierarchicalClustering-
ParametersHNSW-
ParametersISOMAP-
ParametersKDTree-
ParametersKMeans-
ParametersKMedoids-
ParametersLDA-
ParametersLLE-
ParametersLocalMAP-
ParametersLSH-
ParametersLSP-
ParametersLTSA-
ParametersMDS-
ParametersMeanShift-
ParametersMINFOTree-
ParametersNaiveKNN-
ParametersNNDescent-
ParametersOptics-
ParametersPaCMAP-
ParametersPCA-
ParametersSAMMON-
ParametersSMACOF-
ParametersSQDMDS-
ParametersStressMDS-
ParametersTopoMap-
ParametersTriMap-
ParametersTSNE-
ParametersUMAP-
ParametersXMeans-
Comparator-
InputType-
Metric-
ParametersKKMDS-
QRDecomposition-
WeightSpec-
version-
WEIGHTS_ELASTICElastic scaling, also known as the Kamada-Kawai energy. See KKMDS.
WEIGHTS_SAMMONSammon stress. Recovers the objective SAMMON minimises, up to a constant factor.
WEIGHTS_UNIFORMRaw stress: every pair counts equally. Recovers the objective SMACOF minimises.
isWasmAvailableReturns whether WASM acceleration is available in current environment.
isWasmThreadsSupportedReturns whether SharedArrayBuffer and WASM multi-threading is supported in current environment (Node.js, Bun, Deno, or Web Browser with COOP/COEP headers).
minimum_spanning_treeComputes a minimum spanning tree of a weighted graph with Kruskal's algorithm.
parallel_availableWhether row-range kernels can be split across workers in this environment.
quickselectIn-place QuickSelect algorithm to partition an array around the k-th smallest element. Runs in O(N) average time complexity (compared to O(N log N) for full Array.prototype.sort).
quickselectByAxisQuickSelect by specific dimension axis for spatial trees (KDTree, BallTree). Partitions array in-place along arr[i].element[axis].
setWasmEnabledEnables or disables WASM acceleration at runtime.
spatial_treePicks the fastest spatial index that is still correct for the given metric.
terminate_poolStops the workers. They are unreferenced, so this is only needed to release them early.

Utils

NameDescription
RandomizerSeeded pseudo-random number generator.
maxReturns maximum in Array values.
minReturns maximum in Array values.