Main Concept¶
t-SNE aims to visualize high-dimensional data by embedding it into a low-dimensional space (typically 2D or 3D). The core idea is to convert high-dimensional Euclidean distances between data points into conditional probabilities that represent similarities. It then defines a similar probability distribution over points in the low-dimensional map and minimizes the difference between these two distributions. t-SNE focuses on preserving local neighborhood structures, meaning that points that are close together in the high-dimensional space are also likely to be close together in the low-dimensional embedding. It transforms the original data representation by creating a new set of coordinates in a lower-dimensional space. The coordinates of data points change as they are positioned in this new space to reflect the learned similarities, with a focus on preserving local neighborhoods.
Theoretical Aspect¶
t-SNE defines two probability distributions: one in the high-dimensional space and one in the low-dimensional space.
High-dimensional probabilities: The conditional probability that point is a neighbor of point is defined as:
where is the bandwidth of the Gaussian kernel centered on . The joint probability is then defined as:
where is the number of data points.
Low-dimensional probabilities: The probability that point is a neighbor of point in the low-dimensional map is defined using a Student t-distribution with one degree of freedom (which has heavier tails than a Gaussian):
The objective is to minimize the Kullback-Leibler (KL) divergence between these two distributions:
The key variables being optimized are , the matrix of low-dimensional embeddings.
Solution Methodology¶
The optimization is typically performed using gradient descent. The gradient of the KL divergence with respect to the low-dimensional embeddings is:
The algorithm proceeds as follows:
Pairwise Affinities: Compute the pairwise affinities in the high-dimensional space.
Initialization: Initialize the low-dimensional embeddings (e.g., randomly or using PCA).
Optimization: Minimize the KL divergence using gradient descent. This involves iteratively updating the embeddings using the gradient:
where η is the learning rate and α is the momentum.
Iteration: Repeat step 3 until convergence.
The solution involves numerical methods like Gaussian kernels, Student t-distribution, and gradient descent with momentum.
Global Optimality¶
The optimization problem in t-SNE is non-convex, meaning that gradient descent is not guaranteed to find a global minimum. The resulting embedding can be sensitive to the initialization and the choice of hyperparameters (e.g., perplexity, learning rate, momentum). Different initializations can lead to different local minima. The perplexity parameter, which is related to the number of neighbors considered for each point, significantly influences the results.
Conclusion¶
t-SNE is a powerful technique for visualizing high-dimensional data, particularly for revealing cluster structures.

t-SNE applied to MNIST handwritten digits
It focuses on preserving local neighborhoods, making it effective for exploring the local geometry of data. However, it is important to remember that t-SNE is primarily a visualization technique and not a dimensionality reduction technique for downstream tasks. It does not preserve global distances, and the interpretation of cluster sizes and distances between clusters should be done with caution. A meaningful use case is in visualizing gene expression data, where t-SNE can reveal clusters of genes with similar expression patterns across different samples.