Challenge - 5 Problems
Dimensionality Reduction Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
🧠 Conceptual
intermediatePurpose of Dimensionality Reduction Visualization
Why do we use dimensionality reduction techniques like t-SNE or PCA for visualization in machine learning?
Attempts:
2 left
💡 Hint
Think about how humans can best understand complex data.
✗ Incorrect
Dimensionality reduction visualization methods like t-SNE and PCA help convert many features into two or three dimensions so we can plot and see clusters or patterns easily.
❓ Predict Output
intermediateOutput of PCA Dimensionality Reduction Code
What is the shape of the transformed data after applying PCA with 2 components on a dataset with shape (100, 5)?
ML Python
from sklearn.decomposition import PCA import numpy as np X = np.random.rand(100, 5) pca = PCA(n_components=2) X_pca = pca.fit_transform(X) print(X_pca.shape)
Attempts:
2 left
💡 Hint
PCA reduces features but keeps the number of samples the same.
✗ Incorrect
PCA transforms the original data to have fewer features (2 here) but keeps the same number of samples (100). So the output shape is (100, 2).
❓ Model Choice
advancedChoosing a Dimensionality Reduction Method for Visualization
You have a dataset with 1000 features and want to visualize clusters in 2D. Which method is best for preserving local structure and showing clusters clearly?
Attempts:
2 left
💡 Hint
Think about which method is designed to show clusters clearly in low dimensions.
✗ Incorrect
t-SNE is designed to keep similar points close in the low-dimensional space, making clusters visible. PCA focuses on variance but may not separate clusters well.
❓ Metrics
advancedInterpreting Explained Variance Ratio in PCA
After applying PCA with 3 components, the explained variance ratios are [0.5, 0.3, 0.1]. What does this tell you about the data?
Attempts:
2 left
💡 Hint
Explained variance ratio shows how much information each component keeps.
✗ Incorrect
Explained variance ratio shows the proportion of total variance captured by each principal component. Here, 90% of variance is captured by the first 3 components.
🔧 Debug
expertDebugging t-SNE Visualization Code
You run this code to visualize data with t-SNE but get a ValueError: 'perplexity must be less than n_samples'. What is the cause?
ML Python
from sklearn.manifold import TSNE import numpy as np X = np.random.rand(10, 50) tsne = TSNE(n_components=2, perplexity=30) X_embedded = tsne.fit_transform(X) print(X_embedded.shape)
Attempts:
2 left
💡 Hint
Check the relationship between perplexity and sample size in t-SNE.
✗ Incorrect
t-SNE's perplexity parameter must be less than the number of samples. Here, perplexity=30 but only 10 samples exist, causing the error.
