densne: Density-preserving t-SNE

Description Usage Arguments Value References Examples

View source: R/densne.R

Description

Density-preserving t-SNE

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
densne(
  X,
  dims = 2,
  perplexity = 50,
  theta = 0.5,
  verbose = getOption("verbose", FALSE),
  max_iter = 1000,
  Y_init = NULL,
  stop_lying_iter = if (is.null(Y_init)) 250L else 0L,
  mom_switch_iter = if (is.null(Y_init)) 250L else 0L,
  momentum = 0.5,
  final_momentum = 0.8,
  eta = 200,
  exaggeration_factor = 12,
  dens_frac = 0.3,
  dens_lambda = 0.1,
  num_threads = 1
)

Arguments

X

Input data matrix.

dims

Integer output dimensionality.

perplexity

Perplexity parameter (should not be bigger than 3 * perplexity < nrow(X) - 1).

theta

Speed/accuracy trade-off (increase for less accuracy), set to 0.0 for exact TSNE

verbose

Logical; Whether progress updates should be printed

max_iter

integer; Number of iterations

Y_init

matrix; Initial locations of the objects. If NULL, random initialization will be used

stop_lying_iter

integer; Iteration after which the perplexities are no longer exaggerated

mom_switch_iter

integer; Iteration after which the final momentum is used

momentum

numeric; Momentum used in the first part of the optimization

final_momentum

numeric; Momentum used in the final part of the optimization

eta

numeric; Learning rate

exaggeration_factor

numeric; Exaggeration factor used to multiply the affinities matrix P in the first part of the optimization

dens_frac

numeric; fraction of the iterations for which the full objective function (including the density-preserving term) is used. For the first 1 - dens_frac fraction of the iterations, only the original t-SNE objective function is used.

dens_lambda

numeric; the relative importanceof the density-preservation term compared to the original t-SNE objective function.

num_threads

Number of threads to be used for parallelisation.

Value

A numeric matrix corresponding to the t-SNE embedding

References

Density-Preserving Data Visualization Unveils Dynamic Patterns of Single-Cell Transcriptomic Variability Ashwin Narayan, Bonnie Berger, Hyunghoon Cho; bioRxiv (2020) doi:10.1101/2020.05.12.077776

Examples

1
2
3
x <- matrix(rnorm(1e3), nrow = 100)
d <- densne(x, perplexity = 5)
plot(d)

Example output



densvis documentation built on Jan. 28, 2021, 2:01 a.m.