What is the main goal of using t-SNE in data analysis?
Think about what t-SNE does to data dimensions and what it tries to keep intact.
t-SNE reduces data dimensions to 2 or 3 for visualization, focusing on preserving local neighbor relationships.
Given the following Python code using sklearn's t-SNE, what is the shape of tsne_result?
from sklearn.manifold import TSNE import numpy as np X = np.random.rand(100, 50) # 100 samples, 50 features model = TSNE(n_components=2, random_state=42) tsne_result = model.fit_transform(X) print(tsne_result.shape)
Remember, t-SNE reduces features but keeps the number of samples.
t-SNE transforms 100 samples from 50 features to 2 features, so the output shape is (100, 2).
Which statement best describes the effect of increasing the perplexity parameter in t-SNE?
Think about how perplexity relates to neighborhood size in t-SNE.
Perplexity controls the balance between local and global aspects by setting how many neighbors each point considers; higher values mean more neighbors.
Which metric is commonly used to evaluate how well t-SNE preserves local structure in the reduced space?
Consider metrics that measure neighborhood consistency after reduction.
K-nearest neighbor preservation score measures how many neighbors remain the same after dimensionality reduction, reflecting local structure preservation.
What error will this code raise and why?
from sklearn.manifold import TSNE import numpy as np X = np.random.rand(10, 5) model = TSNE(n_components=3, random_state=0) result = model.fit_transform(X) print(result.shape)
Check the allowed output dimensions for t-SNE in sklearn.
No error: sklearn's TSNE supports n_components=1, 2, 3 (and higher with warnings for >3). The output shape is (10, 3).