Computes a low-dimensional nonlinear embededding of the data from the estimated loadings or mixture proportions using the t-SNE nonlinear dimensionality reduction method.
tsne_from_topics( fit, dims = 2, n = 5000, scaling = NULL, pca = FALSE, normalize = FALSE, perplexity = 100, theta = 0.1, max_iter = 1000, eta = 200, check_duplicates = FALSE, verbose = TRUE, ... )
fit | An object of class “poisson_nmf_fit” or “multinom_topic_model_fit”. |
---|---|
dims | The number of dimensions in the t-SNE embedding; passed
as argument “dims” to |
n | The maximum number of rows in the loadings matrix
|
scaling | A numeric vector of length equal to the number of
topics specifying a scaling of the columns of |
pca | Whether to perform a PCA processing stepe in t-SNE;
passed as argument “pca” to |
normalize | Whether to normalize the data prior to running
t-SNE; passed as argument “normalize” to
|
perplexity | t-SNE perplexity parameter, passed as argument
“perplexity” to |
theta | t-SNE speed/accuracy trade-off parameter; passed as
argument “theta” to |
max_iter | Maximum number of t-SNE iterations; passed as
argument “max_iter” to |
eta | t-SNE learning rate parameter; passed as argument
“eta” to |
check_duplicates | When |
verbose | If |
... | Additional arguments passed to |
A list with two list elements: Y
, an n x d matrix
containing the embedding Y
returned by
Rtsne
, where n is the number of rows of the
loadings matrix, and d = dims
; rows
, the rows of the
loadings matrix included in the t-SNE embedding.
This is a lightweight interface for rapidly producing
t-SNE embeddings from matrix factorizations or multinomial topic
models; in particular, tsne_from_topics
replaces the t-SNE
defaults with settings that are more suitable for visualizing the
structure of a matrix factorization or topic model (e.g., the PCA
step in Rtsne
is activated by default, but disabled in
tsne_from_topics
). See Kobak and Berens (2019) for guidance
on choosing t-SNE settings such as the "perplexity" and learning
rate (eta
).
Note that since tsne_plot
uses a nonlinear
transformation of the data, distances between points are less
interpretable than a linear transformation visualized using
pca_plot
for example.
Kobak, D. and Berens, P. (2019). The art of using t-SNE for single-cell transcriptomics. Nature Communications 10, 5416. https://doi.org/10.1038/s41467-019-13056-x