R package for dimensionality reduction of small datasets
// readme
smallvis
An R package for experimenting with dimensionality reduction using neighborhood embedding methods, including t-SNE, LargeVis, and UMAP cost functions. It gives you control over input scaling, nearest neighbors, initialization, and optimization so you can compare methods and try out ideas.
Most methods use quadratic time and memory and suit small datasets. Barnes-Hut t-SNE supports larger datasets through approximate nearest neighbors and multithreaded C++ code.
Install
The R package lives in the smallvis subdirectory. Install it and its dependencies, including the
GitHub package vizier, with
install.packages("pak")
pak::pak("jlmelville/smallvis/smallvis")
Installation from source requires an R-compatible C++ toolchain, such as Rtools on Windows.
Quick start
smallvis() uses the numeric columns of a data frame. This example initializes t-SNE with scaled
PCA coordinates and plots the final embedding.
library(smallvis)
embedding <- smallvis(
iris,
Y_init = "spca",
perplexity = 30,
epoch_callback = FALSE,
n_threads = 1,
verbose = FALSE
)
plot(embedding, col = as.integer(iris$Species), pch = 19)
Set ret_extra = TRUE toβ¦