Learn R Programming

dimRed (version 0.2.0)

UMAP-class: Umap embedding

Description

An S4 Class implementing the UMAP algorithm

Arguments

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/)

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).

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.

References

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

See Also

Other dimensionality reduction methods: AutoEncoder-class, DRR-class, DiffusionMaps-class, DrL-class, FastICA-class, FruchtermanReingold-class, HLLE-class, Isomap-class, KamadaKawai-class, LLE-class, MDS-class, NNMF-class, PCA-class, PCA_L1-class, dimRedMethod-class, dimRedMethodList, kPCA-class, nMDS-class, tSNE-class

Examples

Run this code
# NOT RUN {
dat <- loadDataSet("3D S Curve", n = 300)

## use the S4 Class directly:
umap <- UMAP()
emb <- umap@fun(dat, umap@stdpars)

## or simpler, use embed():
emb2 <- embed(dat, "UMAP", .mute = NULL, knn = 10)
plot(emb2, type = "2vars")
# }
# NOT RUN {
# }

Run the code above in your browser using DataLab