pub struct Tsne { /* private fields */ }Expand description
Exact t-SNE (van der Maaten and Hinton): embeds high-dimensional points in 2D or 3D so that neighbours stay neighbours. Pairwise similarities in the input are Gaussian with a per-point bandwidth chosen to match a target perplexity (the effective number of neighbours); in the embedding they are Student-t distributed (heavy tails let dissimilar clusters separate). The embedding minimises the KL divergence between the two by gradient descent with momentum and adaptive gains, using “early exaggeration” of the input similarities at the start to form clusters.
The exact method costs O(n²) per iteration, fine for up to a few thousand points. Only the
layout of the fitted points is produced: t-SNE has no transform for new data, and distances
between clusters in the picture are not meaningful.
Implementations§
Source§impl Tsne
impl Tsne
Sourcepub fn new(components: usize, perplexity: f64) -> Self
pub fn new(components: usize, perplexity: f64) -> Self
components output dimensions (2 or 3 typical); perplexity roughly 5 to 50.
pub fn with_iterations(self, iterations: usize) -> Self
pub fn with_learning_rate(self, learning_rate: f64) -> Self
Sourcepub fn kl_divergence(&self) -> f64
pub fn kl_divergence(&self) -> f64
The KL divergence of the final embedding (lower is a better match to the input).