tSNE | R Documentation |
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.
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
)
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. |
ydata : An R object containing a ydata embedding matrix, as well as a the matrix of probabilities P
## 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])
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.