Skip to contents

An S4 Class implementing the UMAP algorithm

Details

Uniform Manifold Approximation is a gradient descend based algorithm that gives results similar to t-SNE, but scales better with the number of points.

Slots

fun

A function that does the embedding and returns a dimRedResult object.

stdpars

The standard parameters for the function.

General usage

Dimensionality reduction methods are S4 Classes that either be used directly, in which case they have to be initialized and a full list with parameters has to be handed to the @fun() slot, or the method name be passed to the embed function and parameters can be given to the ..., in which case missing parameters will be replaced by the ones in the @stdpars.

Parameters

UMAP can take the follwing parameters:

ndim

The number of embedding dimensions.

knn

The number of neighbors to be used.

d

The distance metric to use.

method

"naive" for an R implementation, "python" for the reference implementation.

Other method parameters can also be passed, see umap.defaults for details. The ones above have been standardized for the use with dimRed and will get automatically translated for umap.

Implementation

The dimRed package wraps the umap packages which provides an implementation in pure R and also a wrapper around the original python package umap-learn (https://github.com/lmcinnes/umap/). This requires umap-learn version 0.4 installed, at the time of writing, there is already umap-learn 0.5 but it is not supported by the R package umap.

The "naive" implementation is a pure R implementation and considered experimental at the point of writing this, it is also much slower than the python implementation.

The "python" implementation is the reference implementation used by McInees et. al. (2018). It requires the reticulate package for the interaction with python and the python package umap-learn installed (use pip install umap-learn).

References

McInnes, Leland, and John Healy. "UMAP: Uniform Manifold Approximation and Projection for Dimension Reduction." https://arxiv.org/abs/1802.03426

Examples

if (FALSE) {
dat <- loadDataSet("3D S Curve", n = 300)
emb <- embed(dat, "UMAP", .mute = NULL, knn = 10)
plot(emb, type = "2vars")
}