tSNE: The t-SNE method for dimensionality reduction

View source: R/tSNE.R

tSNER Documentation

The t-SNE method for dimensionality reduction

Description

This function is copied from the tsne package found in CRAN. Provides a simple function inteface for specifying t-SNE dimensionality reduction on R matrices or "dist" objects.

Usage

tSNE(
  X,
  initial_config = NULL,
  k = 2,
  initial_dims = 30,
  perplexity = 30,
  max_iter = 1000,
  min_cost = 0,
  epoch_callback = NULL,
  whitening = FALSE,
  epoch = 100
)

Arguments

X

The R matrix or "dist" object

initial_config

An argument providing a matrix specifying the initial embedding for X. See Default is NULL.

k

The dimension of the resulting embedding. Default is 2.

initial_dims

The number of dimensions to use in reduction method, if whitening True. Default is 30.

perplexity

Perplexity parameter. (optimal number of neighbors). Default is 30.

max_iter

Maximum number of iterations to perform. Default is 1000.

min_cost

The minimum cost value (error) to halt iteration. Default is 0.

epoch_callback

A callback function used after each epoch (an epoch here means a set number of iterations). Default is NULL.

whitening

A boolean value indicating whether the matrix data should be whitened. Default is FALSE.

epoch

The number of iterations in between update messages. Default is 100.

Value

ydata : An R object containing a ydata embedding matrix, as well as a the matrix of probabilities P

Examples

## Not run: 
colors = rainbow(length(unique(iris$Species)))
names(colors) = unique(iris$Species)
ecb = function(x,y){ plot(x,t='n'); text(x,labels=iris$Species, col=colors[iris$Species]) }
tsne_iris = tsne(iris[,1:4], epoch_callback = ecb, perplexity=50)

# compare to PCA
dev.new()
pca_iris = princomp(iris[,1:4])$scores[,1:2]
plot(pca_iris, t='n')
text(pca_iris, labels=iris$Species,col=colors[iris$Species])


theorod93/multiSNE documentation built on April 22, 2024, 11:16 a.m.