Quiz 2
Registry Synced

PCA and t-SNE

62 words
1 min read

Reading compass

Now · PCA (Principal Component Analysis)

PCA and t-SNE

PCA (Principal Component Analysis)

python
from sklearn.decomposition import PCA
import matplotlib.pyplot as plt
pca = PCA(n_components=2)
X_pca = pca.fit_transform(X)
plt.scatter(X_pca[:, 0], X_pca[:, 1], c=y, cmap='viridis')
plt.xlabel(f"PC1 ({pca.explained_variance_ratio_[0]:.1%})")
plt.ylabel(f"PC2 ({pca.explained_variance_ratio_[1]:.1%})")
plt.title("PCA of Dataset")
plt.show()

t-SNE

python
from sklearn.manifold import TSNE
tsne = TSNE(n_components=2, random_state=42)
X_tsne = tsne.fit_transform(X)
MethodLinear?Preserves Distances?Best For
PCAYesGlobalFeature extraction
t-SNENoLocalVisualization
UMAPNoBothGeneral
Document outline

Keep your place and jump directly to a heading.

Table of Contents
System Normal // Awaiting Context

Intelligence Hub

Navigate the knowledge graph to generate context. The Hub adapts dynamically to surface backlinks, related notes, and metadata insights.