Uniform Manifold Approximation and Projection (UMAP) is a dimension reduction technique that can be used for visualisation similarly to t-SNE, but also for general non-linear dimension reduction.
There are a few important differences between the python implementation and the JS port.
- The optimization step is seeded with a random embedding rather than a spectral embedding. This gives comparable results for smaller datasets. The spectral embedding computation relies on efficient eigenvalue / eigenvector computations that are not easily done in JS.
- There is no specialized functionality for angular distances or sparse data representations.
yarn add umap-js
;const umap = ;const embedding = umap;
;const umap = ;const embedding = await umap;
;const umap = ;const nEpochs = umap;for let i = 0; i < nEpochs; i++umap;const embedding = umap;
Supervised projection using labels
;const umap = ;umap;const embedding = umap;
Transforming additional points after fitting
;const umap = ;umap;const transformed = umap;
The UMAP constructor can accept a number of hyperparameters via a
UMAPParameters object, with the most common described below. See umap.ts for more details.
||The number of components (dimensions) to project the data to||2|
||The number of epochs to optimize embeddings via SGD||(computed automatically)|
||The number of nearest neighbors to construct the fuzzy manifold||15|
||The effective minimum distance between embedded points, used with
||The effective scale of embedded points, used with
||A pseudo-random-number generator for controlling stochastic processes||
||A custom distance function to use||
jest for testing.
This is not an officially supported Google product