Back to the 2022 paper

Module 4: Clustering, K-means, K-medoids, Density-based Hierarchical, Spectral .

20227m

What is the difference between K-means and K-medoid algorithm? Explain density-based hierarchical clustering.

Worked SolutionAI Assisted

K-means vs K-medoid:

Aspect K-means (Lloyd) K-medoid (PAM)
Center Centroid = mean μj=1∣Cj∣∑x\mu_j=\frac1{|C_j|}\sum x (not necessarily data point, continuous) Medoid = actual data point minimizing sum distance to cluster members
Distance Euclidean (minimizes SSE) Any metric (Manhattan, arbitrary dissimilarity)
Robustness Sensitive to outliers (mean shifts) Robust (medoid not affected by extreme outlier)
Cost function J=∑∑∣∣x−μ∣∣2J=\sum\sum||x-\mu||^2 E=∑∑d(x,mj)E=\sum\sum d(x,m_j)
Complexity O(nkdi)O(nkdi) fast O(k(n−k)2)O(k(n-k)^2) per iteration (PAM) much slower, CLARA/CLARANSCLARA/CLARANS for large data
When to use Continuous, spherical clusters, fast Categorical/mixed, need representatives from dataset, noisy data

Density-Based Hierarchical Clustering:

Combines density and hierarchy. Unlike flat K-means, builds tree (dendrogram) where clustering reflects density connectivity at different thresholds.

  • Core idea: Clusters are dense regions separated by sparse regions. Define ϵ\epsilon-neighborhood and minPtsminPts. Point types: core (≥minPtsminPts in ϵ\epsilon), border, noise. Hierarchical variant (e.g., HDBSCAN, OPTICS, DENCLUE hierarchical) varies ϵ\epsilon/density threshold to create hierarchy.

  • OPTICS: Ordering Points To Identify Clustering Structure — computes reachability distance, produces reachability plot, extracts hierarchy without fixing single ϵ\epsilon.

  • HDBSCAN: Converts DBSCAN to hierarchical, builds minimum spanning tree of mutual reachability, condenses, selects stable clusters via persistence λ=1/distance\lambda=1/distance.

  • Hierarchical density dendrogram: Bottom leaves = core points merge at lowest density threshold as ϵ\epsilon increases.

Advantages: Finds arbitrary shapes, handles noise, no need to preset kk, hierarchy reveals clusters at multiple densities.

Steps generic: Estimate density (kernel), build graph where edges if density > threshold, connected components = clusters, vary threshold → hierarchy, prune unstable branches.

Similar questions

Official AppAndroid App

PYQDeck for Android

Solve BEU previous-year exam papers anywhere, anytime. Fast search, offline paper viewing, and step-by-step solutions designed specifically for your phone.