tsne_dist: Dimension reduction with t-SNE

Description Usage Arguments Details Value Control References See Also Examples

Description

t-Distributed Stochastic Neighbor Embedding (t-SNE).

Usage

1
2
3
4
5
tsne_dist(dist_, dimensions = 2, verbose = 0, rng_seed = NULL,
  control = list())

tsne(xdata, perplexity = 25, dimensions = 2, verbose = 0,
  rng_seed = NULL, control = list())

Arguments

dist_

A matrix or dist object woth pairwise dissimilarities. All elements must be positive and sum to 1.

dimensions

The number of dimensions of the t-SNE embedding. Default is 2, which is usually adequate.

verbose

The amount of output during the t-SNE estimation. Can be 0 (no output), 1 (some output, including a progress bar) and 2 (detailed output, mostly usefull for debugging purposes)

rng_seed

Provide a seed for generating intiial values for the coordiantes. The final t-SNE result is highly sensitive for starting values, so to get reproducible results you should provide a seed.

control

A list of control parameters. See 'Details'.

xdata

A matrix or data frame.

perplexity

The perplexity. Usually a number between 5 and 50. Default is 25.

Details

tsne_from_dist assumes that dist_ is a distance matrix interpretable as a nearest neighbor distribution. If you only have a distance matrix, you can use the dist_to_sne function to create a SNE dissimilarity matrix.

Function tsne provides a convenient interface to use t-SNE using raw data. Under the hood it calls the dist_sne and tsne_dist functions.

Value

A list of class 'tsne' with the following elements:

par: A matrix with the t-SNE embedding.
trace: A vector of the Kullback-Leibler divergences. If you used early exaggeration (default) you will see a large jump in the values at iteration 50.

Control

The control argument is a list that can supply any of the following components:

max_iter: The number of iterations. Default is 1000.
step_size: The gradient descent step size. Default is 100, but it can sometimes be usefull to set this to a lower value.
momentum_values: A vector of values that determines the momentum. The default is c(0.5, 0.8), following the original t-SNE paper.
momentum_iter: A vector of values that determines the iterations the momentum_values should be used. Default is c(250, 1000), following the original t-SNE paper.
early_exageration_iter: Numerical. The number of iterations the early exageration trick should be used. Default 50.
early_exageration_factor: Numerical. The exageration factor used in the early exacegration phase. Default is 4.

References

See Also

The tsne_phyloseq function provides a nice interface for using t-SNE with microbiota data.

Examples

1
2
3
xx <- make_swiss_roll(150)
tsne_res <- tsne(xx[,1:3])
plot(tsne_res$par, col=xx[,4], pch=16)

opisthokonta/tsnemicrobiota documentation built on June 1, 2019, 9:44 a.m.