Data Science with Python Certification Data Science with Python Unsupervised Learning Algorithms 5 — Questions and Answers
Question 1: What problem does K-Means++ initialization solve compared to random initialization?
- It reduces the chance of converging to a poor local minimum by spreading initial centroids (Correct answer)
- It automatically determines the optimal k value
- It speeds up each iteration of the algorithm
- It handles categorical features natively
Correct answer: It reduces the chance of converging to a poor local minimum by spreading initial centroids
K-Means++ selects initial centroids probabilistically to be far apart, leading to better and faster convergence.
Question 2: Which dimensionality reduction technique preserves global structure better than t-SNE?
- UMAP (Correct answer)
- Isomap
- LLE
- Factor Analysis
Correct answer: UMAP
UMAP better preserves global structure compared to t-SNE while still capturing local neighborhoods effectively.
Question 3: What does a Davies-Bouldin index close to 0 indicate?
- Better clustering with well-separated, compact clusters (Correct answer)
- Clusters with high internal variance
- A model that overfits the training data
- Poor clustering quality
Correct answer: Better clustering with well-separated, compact clusters
Lower Davies-Bouldin values indicate clusters that are compact internally and well-separated from each other.
Question 4: In Online/Mini-Batch K-Means, what is the key trade-off compared to standard K-Means?
- Faster convergence and lower memory usage at the cost of slightly lower cluster quality (Correct answer)
- Better cluster quality but requires more memory
- Exact same results but with faster computation
- Automatic determination of the number of clusters
Correct answer: Faster convergence and lower memory usage at the cost of slightly lower cluster quality
Mini-Batch K-Means uses random subsets of data per iteration, trading a small quality drop for significant speed and memory gains.
Question 5: Which of the following correctly describes 'soft clustering' in GMM versus 'hard clustering' in K-Means?
- GMM assigns probabilities of belonging to each cluster; K-Means assigns each point to exactly one cluster (Correct answer)
- GMM assigns each point to one cluster; K-Means gives probabilities
- Both methods assign probabilities of membership
- Both methods assign each point to exactly one cluster
Correct answer: GMM assigns probabilities of belonging to each cluster; K-Means assigns each point to exactly one cluster
GMM produces probabilistic (soft) assignments where each point has a probability for every cluster, unlike K-Means' hard assignments.
Question 6: What is the role of the `eps` parameter in DBSCAN?
- It defines the radius of the neighborhood around each point (Correct answer)
- It sets the minimum number of points to form a core point
- It controls the number of clusters to find
- It specifies the distance metric to use
Correct answer: It defines the radius of the neighborhood around each point
`eps` (epsilon) is the maximum distance between two points for one to be considered in the neighborhood of the other.
Question 7: When applying `TruncatedSVD` instead of `PCA` in scikit-learn, what is the main practical reason?
- TruncatedSVD works on sparse matrices without centering, making it efficient for text data (Correct answer)
- TruncatedSVD is always faster than PCA on dense data
- TruncatedSVD automatically selects the number of components
- TruncatedSVD handles categorical features natively
Correct answer: TruncatedSVD works on sparse matrices without centering, making it efficient for text data
TruncatedSVD does not center the data, preserving sparsity and making it suitable for large sparse matrices like TF-IDF vectors.
What problem does K-Means++ initialization solve compared to random initialization?