Why is Partitioning Around Medoids (PAM) computationally more expensive per iteration than Lloyd's k-means?

Quick Overview

Asks why each iteration of Partitioning Around Medoids costs far more than an iteration of Lloyd's k-means. It tests complexity analysis of the assignment, update and swap steps, why medoids lack a closed-form update, the memory cost of distance matrices, and faster medoid variants.

Why is Partitioning Around Medoids (PAM) computationally more expensive per iteration than Lloyd's k-means?

Role: Machine Learning Engineer

Category: Machine Learning

Difficulty: medium

Interview Round: Other

Why is Partitioning Around Medoids (PAM) computationally more expensive per iteration than Lloyd's k-means? ```hint Updating one center For a fixed set of points in one cluster, compare how each algorithm finds the best center for them. ``` ```hint Count the work in one sweep Count how many candidate changes PAM considers in an iteration and how many points each candidate has to touch. ``` ### What a Strong Answer Covers - The per-iteration complexity of each algorithm, with where each term comes from - Why the mean has a closed-form update and a medoid under an arbitrary dissimilarity does not - The memory cost of the pairwise distance matrix - Faster variants and approximations, and what each one gives up ### Follow-up Questions - When would you still choose k-medoids over k-means despite the cost? - How do FastPAM and FasterPAM bring the swap step down to about $O(n^2)$ per iteration? - For 1 million points, how would you make a medoid-based clustering feasible? - Does PAM find the global optimum, and how does its result compare with Lloyd's algorithm on that front?

Overview: Asks why each iteration of Partitioning Around Medoids costs far more than an iteration of Lloyd's k-means. It tests complexity analysis of the assignment, update and swap steps, why medoids lack a closed-form update, the memory cost of distance matrices, and faster medoid variants.

General logo
General
Nov 25, 2026
mediumMachine Learning EngineerOtherMachine Learning
0
0

Why is Partitioning Around Medoids (PAM) computationally more expensive per iteration than Lloyd's k-means?

What a Strong Answer Covers Guidance

  • The per-iteration complexity of each algorithm, with where each term comes from
  • Why the mean has a closed-form update and a medoid under an arbitrary dissimilarity does not
  • The memory cost of the pairwise distance matrix
  • Faster variants and approximations, and what each one gives up

Follow-up Questions Guidance

  • When would you still choose k-medoids over k-means despite the cost?
  • How do FastPAM and FasterPAM bring the swap step down to about O(n2)O(n^2) per iteration?
  • For 1 million points, how would you make a medoid-based clustering feasible?
  • Does PAM find the global optimum, and how does its result compare with Lloyd's algorithm on that front?