Data Science with Python Certification Data Science with Python Unsupervised Learning Algorithms 2 — Questions and Answers
Question 1: Which distance metric is most sensitive to outliers in clustering?
- Euclidean distance (Correct answer)
- Manhattan distance
- Cosine similarity
- Hamming distance
Correct answer: Euclidean distance
Euclidean distance squares differences, amplifying the effect of outliers compared to other metrics.
Question 2: In DBSCAN, what is a 'border point'?
- A point within epsilon of a core point but not itself a core point (Correct answer)
- A point with no neighbors within epsilon
- A point that defines cluster boundaries algorithmically
- A core point on the edge of the dataset
Correct answer: A point within epsilon of a core point but not itself a core point
A border point is reachable from a core point but has fewer than MinPts neighbors within epsilon.
Question 3: Which Python library provides the `AgglomerativeClustering` class?
- sklearn.cluster (Correct answer)
- scipy.cluster
- numpy.cluster
- pandas.cluster
Correct answer: sklearn.cluster
`AgglomerativeClustering` is part of scikit-learn's `sklearn.cluster` module.
Question 4: What does the cophenetic correlation coefficient measure in hierarchical clustering?
- How faithfully the dendrogram preserves pairwise distances (Correct answer)
- The number of optimal clusters
- The within-cluster sum of squares
- The height at which clusters merge
Correct answer: How faithfully the dendrogram preserves pairwise distances
The cophenetic correlation coefficient compares original pairwise distances to dendrogram distances to evaluate linkage quality.
Question 5: When applying PCA, what does a negative eigenvalue indicate?
- A numerical error, since covariance matrices always yield non-negative eigenvalues (Correct answer)
- A principal component that explains negative variance
- A direction of maximum compression
- An outlier principal component
Correct answer: A numerical error, since covariance matrices always yield non-negative eigenvalues
Covariance matrices are positive semi-definite, so all eigenvalues must be ≥ 0; negatives indicate numerical precision errors.
Question 6: Which linkage criterion in hierarchical clustering tends to produce compact, roughly equal-sized clusters?
- Ward linkage (Correct answer)
- Complete linkage
- Single linkage
- Average linkage
Correct answer: Ward linkage
Ward linkage minimizes the total within-cluster variance, producing compact and balanced clusters.
Question 7: In t-SNE, what does the perplexity parameter control?
- The effective number of neighbors considered for each point (Correct answer)
- The number of output dimensions
- The learning rate of gradient descent
- The random seed for initialization
Correct answer: The effective number of neighbors considered for each point
Perplexity in t-SNE balances attention between local and global structure by controlling the effective neighborhood size.
Which distance metric is most sensitive to outliers in clustering?