- k-means is a partitional, iterative clustering algorithm.
- User specifies k = number of clusters.
- Clusters do not overlap: each data point finally belongs to exactly one cluster.
- Works well for spherical or circular shaped clusters.
- Initial centroids are usually selected randomly.
k-means Algorithm
1️⃣ Choose number of clusters, k.
2️⃣ Randomly choose k initial data points as centroids.
3️⃣ Assign each data point to the nearest centroid (using Euclidean distance or similar).
4️⃣ Compute new centroids as the mean of all points assigned to each cluster.
5️⃣ Repeat steps 3–4 until no change in assignment (convergence).

Advantages:
- Simple and intuitive
- Easy to implement
Disadvantages:
- Sensitive to initial centroids
- For large datasets: can be computationally expensive