BIT454 · 2081 · 10 marks
List different clustering approaches. Write the algorithm of K-means algorithm. What are its limitations?
List different clustering approaches. Write the algorithm of K-means algorithm. What are its limitations?[10]
Quick answer
Clustering approaches can be classified into the following main categories: Partitioning Methods; Divide data into k non-overlapping clusters; Examples.
Model Answer: Clustering Approaches and K-Means Algorithm
Different Clustering Approaches (3 marks)
Clustering approaches can be classified into the following main categories:
-
Partitioning Methods
- Divide data into k non-overlapping clusters
- Examples: K-means, K-medoids, PAM (Partitioning Around Medoids)
-
Hierarchical Methods
- Build a hierarchy of clusters (dendrogram)
- Agglomerative (bottom-up): Start with individual points, merge into clusters
- Divisive (top-down): Start with one cluster, split into smaller clusters
-
Density-Based Methods
- Cluster based on density of data points
- Examples: DBSCAN, OPTICS
- Can find arbitrary-shaped clusters
-
Grid-Based Methods
- Divide data space into grid cells
- Cluster based on grid structure
- Example: STING
-
Model-Based Methods
- Assume data generated from probability distribution
- Example: Gaussian Mixture Models (GMM)
K-Means Algorithm (5 marks)
Algorithm Steps:
Input: Dataset D with n objects, number of clusters k
Output: k clusters with minimum within-cluster variance
Steps:
-
Initialize: Randomly select k initial cluster centers (centroids) from the dataset or randomly in the data space.
-
Assignment Step: Assign each data point to the nearest centroid using Euclidean distance:
For each point x_i in D: d = minimum distance to any centroid Assign x_i to cluster C_j where centroid is nearest -
Update Step: Recalculate centroids as the mean of all points in each cluster:
For each cluster C_j: centroid_j = (1/|C_j|) * Σ(x_i) for all x_i in C_j -
Convergence Check: If centroids have not changed (or change is below threshold), stop. Otherwise, go to Step 2.
-
Output: Final k clusters and their centroids.
Pseudocode:
Algorithm K-Means(D, k)
C = randomly select k centroids from D
repeat
for each point x in D do
assign x to nearest centroid
end for
for each cluster j do
update centroid_j = mean of all points in cluster j
end for
until centroids do not change
return clusters
Limitations of K-Means (2 marks)
-
Sensitive to Initial Centroids: Different initial selections may lead to different final clusters. Algorithm may converge to local optima rather than global optimum.
-
Fixed Number of Clusters: Must specify k in advance. No automatic method to determine optimal k.
-
Assumes Spherical Clusters: Works best with roughly spherical, similarly-sized clusters. Fails with elongated or irregular cluster shapes.
-
Sensitive to Outliers: Outliers can significantly affect centroid calculation and cluster quality.
-
Computational Cost: For large datasets with many dimensions, distance calculations become expensive.
-
Equal Cluster Size Assumption: Tends to produce clusters of roughly equal size, which may not reflect actual data distribution.
-
Convergence Issues: May converge slowly or get stuck in local minima.
-
Not Suitable for Categorical Data: K-means uses Euclidean distance, designed for numerical data only.
Short on time? The 1, 5 and 10 mark versions of this answer, flashcards and practice sets come with a program pass.