---
title: "Compare k-means, k-medoids, k-modes"
subject: "Data Mining"
chapter: 5
key: "semester_7/data_mining:kmeans-kmedoids-kmodes"
source: https://www.bctengineer.com/q/semester_7/data_mining/kmeans-kmedoids-kmodes
site: BCT Engineering
---

# Compare k-means, k-medoids, k-modes

Data Mining · Chapter 5: Cluster Analysis

- Asked in: year not given
- Video: [Lec-17: K-medoids Clustering with Numerical Example | Machine Learning](https://www.youtube.com/watch?v=FosEwkYIGmU) — Gate Smashers
- Answer checked by Claude Opus 5.5 (high effort) on 2026-10-14
- Page: https://www.bctengineer.com/q/semester_7/data_mining/kmeans-kmedoids-kmodes
- Whole chapter: https://www.bctengineer.com/md/semester_7/data_mining/chapter-5

## Question

Compare k-means, k-medoids, and k-modes algorithm.

## Short answer

k-means uses mean (numeric, sensitive to outliers); k-medoids uses an actual object as medoid (robust to outliers, any dissimilarity, but slower O(k(n−k)²)); k-modes uses the mode for categorical data with matching dissimilarity. All three are partitioning methods that iteratively relocate objects.

## Answer

All three are partitioning methods that form k clusters by iterative relocation, but they differ in the cluster representative and the type of data.

| Basis | k-means | k-medoids (PAM) | k-modes |
| --- | --- | --- | --- |
| Cluster centre | **Mean** of the objects (may not be an actual object) | **Medoid**: an actual, most central object | **Mode**: the most frequent value of each attribute |
| Data type | Numeric (continuous) | Numeric, and any type with a dissimilarity measure | Categorical |
| Dissimilarity | Euclidean distance | Any distance (e.g. Manhattan) | Number of mismatches between attribute values (simple matching) |
| Objective | Minimise sum of squared errors | Minimise sum of absolute dissimilarities to medoids | Minimise total mismatches to modes |
| Update step | Recompute mean | Swap a medoid with a non-medoid if cost falls | Recompute mode of each attribute |
| Outliers/noise | Very sensitive | Robust (medoid is not shifted by outliers) | Moderately robust |
| Complexity | O(nkt) | O(k(n − k)²) per iteration, costly for big data | O(nkt), efficient |
| Scalability | High | Low (CLARA/CLARANS for large data) | High |
| Example | Cluster customers by (age, income) | Cluster with outliers, e.g. house prices | Cluster by (colour, make, city) |

**Summary**: k-means is fast but sensitive to outliers; k-medoids is robust but slower; k-modes extends the k-means paradigm to categorical data by using modes and a matching dissimilarity (k-prototypes handles mixed data).

## Check yourself

The answer's key points as multiple-choice questions, with the correct option and why.

1. What represents a cluster in k-means, k-medoids and k-modes respectively?
   A. Medoid, mode, mean
   B. Mean, medoid, mode
   C. Mode, mean, medoid
   D. Mean, mode, medoid
   Answer: B. k-means uses the mean, k-medoids an actual central object, and k-modes the most frequent value of each attribute. (Key point: Cluster centre)

2. Which algorithm suits categorical data, and what dissimilarity does it use?
   A. k-means, Euclidean distance
   B. k-medoids, squared error
   C. k-modes, number of mismatches between attribute values
   D. k-means, number of mismatches
   Answer: C. k-modes uses simple matching (count of mismatched attributes) with modes for categorical data. (Key point: Data type)

3. Which is most robust to outliers and why?
   A. k-means, since the mean averages out errors
   B. k-medoids, since the medoid is an actual object not shifted by outliers
   C. k-modes, since it uses squared errors
   D. All equally robust
   Answer: B. A medoid is a real central object so outliers barely move it; k-means is very sensitive. (Key point: Robustness)

4. How do k-medoids (PAM) compare in scalability?
   A. Highest scalability, O(nkt)
   B. Low scalability, costly for big data (CLARA/CLARANS help)
   C. Same as k-modes
   D. They cannot be applied to numeric data
   Answer: B. PAM costs O(k(n-k)^2) per iteration, so CLARA or CLARANS are used for large data. (Key point: Cost)

## Related in Data Mining

- [K-means on six 2-D instances (B65)](https://www.bctengineer.com/question.md?key=semester_7%2Fdata_mining%3Akmeans-b65) — Data Mining, chapter 5
- [Need of clustering; hierarchical vs partitioning; K-means](https://www.bctengineer.com/question.md?key=semester_7%2Fdata_mining%3Acluster-need-hier-vs-partition-kmeans) — Data Mining, chapter 5
- [Likelihood and distance; K-means drawbacks](https://www.bctengineer.com/question.md?key=semester_7%2Fdata_mining%3Alikelihood-distance-clustering-kmeans-drawbacks) — Data Mining, chapter 3
- [Cluster analysis; K-means on height/width](https://www.bctengineer.com/question.md?key=semester_7%2Fdata_mining%3Akmeans-height-width) — Data Mining, chapter 5
- [K-means on six 2-D instances (K=2)](https://www.bctengineer.com/question.md?key=semester_7%2Fdata_mining%3Akmeans-x-y-k2) — Data Mining, chapter 5
- [Cluster analysis applications; K-means](https://www.bctengineer.com/question.md?key=semester_7%2Fdata_mining%3Acluster-application-kmeans) — Data Mining, chapter 5

## Related in other subjects

- [Compare TSI write/read modes](https://www.bctengineer.com/question.md?key=semester_8%2Ftelecommunications%3Atsi-write-read-modes-compare) — Telecommunications, chapter 4
- [Compare and contrast pollution in a city](https://www.bctengineer.com/question.md?key=semester_5%2Fcommunication_english%3Acompare-contrast-pollution-city-nepal) — Communication English, chapter 1
- [Compare two S-matrix sets; stability and gains](https://www.bctengineer.com/question.md?key=semester_7%2Frf_and_microwave_engineering%3Aamplifier-two-s-matrix-sets) — RF and Microwave Engineering, chapter 6
- [Compare DDA/Bresenham; midpoint ellipse](https://www.bctengineer.com/question.md?key=semester_5%2Fcomputer_graphics%3Acompare-dda-bresenham-midpoint-ellipse) — Computer Graphics, chapter 2
