2081 1

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]

Data Warehousing and Data MiningChapter 5: Clustering MethodsK-means algorithm and limitations

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:

  1. Partitioning Methods

    • Divide data into k non-overlapping clusters
    • Examples: K-means, K-medoids, PAM (Partitioning Around Medoids)
  2. 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
  3. Density-Based Methods

    • Cluster based on density of data points
    • Examples: DBSCAN, OPTICS
    • Can find arbitrary-shaped clusters
  4. Grid-Based Methods

    • Divide data space into grid cells
    • Cluster based on grid structure
    • Example: STING
  5. 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:

  1. Initialize: Randomly select k initial cluster centers (centroids) from the dataset or randomly in the data space.

  2. 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
    
  3. 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
    
  4. Convergence Check: If centroids have not changed (or change is below threshold), stop. Otherwise, go to Step 2.

  5. 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)

  1. Sensitive to Initial Centroids: Different initial selections may lead to different final clusters. Algorithm may converge to local optima rather than global optimum.

  2. Fixed Number of Clusters: Must specify k in advance. No automatic method to determine optimal k.

  3. Assumes Spherical Clusters: Works best with roughly spherical, similarly-sized clusters. Fails with elongated or irregular cluster shapes.

  4. Sensitive to Outliers: Outliers can significantly affect centroid calculation and cluster quality.

  5. Computational Cost: For large datasets with many dimensions, distance calculations become expensive.

  6. Equal Cluster Size Assumption: Tends to produce clusters of roughly equal size, which may not reflect actual data distribution.

  7. Convergence Issues: May converge slowly or get stuck in local minima.

  8. 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.