Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

UMAP-class

Umap embedding


Description

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

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

See Also

Examples

## 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")

## End(Not run)

dimRed

A Framework for Dimensionality Reduction

v0.2.3
GPL-3 | file LICENSE
Authors
Guido Kraemer [aut, cre]
Initial release

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.