t-SNE: Practical Considerations and Common Pitfalls
You'll learn why t-SNE is strictly for visualization, how randomness affects your results, and what distances in t-SNE plots actually mean.
Why t-SNE is for Visualization Only
t-SNE is a powerful tool for exploring and visualizing high-dimensional data, but it should never be used as a preprocessing step before modeling. Unlike PCA, t-SNE doesn't preserve global structure reliably, and its output depends heavily on random initialization. Using t-SNE embeddings as features for machine learning models will likely hurt performance because:
- The algorithm optimizes for local neighborhood preservation, not predictive relationships
- Results are non-deterministic and change between runs
- The transformation cannot be applied to new test data consistently
Think of t-SNE like creating a hand-drawn map of a city that highlights interesting neighborhoods—great for exploration, but you wouldn't use it for GPS navigation.
Random Initialization Matters
Because t-SNE uses gradient descent with random initialization, running it twice produces different plots. This is normal! The overall patterns (clusters, separations) should remain consistent, but exact positions will vary. Always set a random seed for reproducibility when sharing results.
Interpreting Distances Carefully
Distances between clusters in t-SNE plots are meaningless. t-SNE preserves local neighborhoods, so nearby points are likely similar, but the gap between distant clusters tells you nothing about how different they are. Two clusters far apart might be quite similar in the original space; two clusters close together might actually be very different.
Also, cluster sizes in t-SNE aren't proportional to actual data density—they're artifacts of the algorithm.
Key Takeaway: Use t-SNE exclusively for visualization, expect different layouts from different runs, trust only local structure (nearby points), and never interpret distances between well-separated clusters as meaningful.