IAE Academy

Clustering formulas

Clustering: k-means, k-medoids and hierarchical clustering. 14 formulas for GATE DA Machine Learning, each with when to use it. Each is explained in the topic notes.

All 14 Clustering formulas

EUCLIDEAN DISTANCE

Default distance. k-means is built around its square.

MANHATTAN DISTANCE

Sum of absolute coordinate differences. For (1,1) and (4,5): Manhattan = 3 + 4 = 7, Euclidean = 5.

K-MEANS OBJECTIVE (WCSS)

Squared Euclidean distance of each point to its own cluster's centroid, summed over all points.

ASSIGNMENT STEP

Nearest centroid in Euclidean distance (squaring does not change which centroid is nearest). Ties need a fixed rule: keep the point in its current cluster if that cluster is among the nearest, otherwise take the lowest index.

UPDATE STEP (CENTROID)

Defined for a non-empty cluster. The mean is the point that minimises the sum of squared Euclidean distances to the cluster's points, so this step cannot increase .

WCSS FROM PAIRWISE DISTANCES

The double sum runs over all ordered pairs (each unordered pair counted twice). Useful when only distances are given. Check: for {1, 2, 4} the right side is 28/6 = 4.667, the same as the left.

SILHOUETTE COEFFICIENT OF POINT I

= mean distance from point to the other points of its own cluster; = the smallest, over the other clusters, of the mean distance from to that cluster's points. : near 1 means well placed, negative means is on average closer to another cluster. By convention if is alone in its cluster. A higher average over all points indicates a better .

MEDOID OF A CLUSTER

The member of the cluster with the smallest total dissimilarity to the other members. k-medoids minimises .

SINGLE LINKAGE (NEAREST NEIGHBOUR)

Closest pair across the two clusters. Prone to chaining: a line of nearby points joins distant groups into one long cluster.

COMPLETE LINKAGE (FARTHEST NEIGHBOUR)

Farthest pair across the two clusters. Favours compact clusters of similar diameter.

AVERAGE LINKAGE

Mean of all cross-cluster pairwise distances. For the same pair of clusters it lies between the single-linkage and complete-linkage values.

WARD'S LINKAGE

The increase in total WCSS caused by merging and ; it merges the pair that increases the WCSS least. Needs Euclidean coordinates (centroids). Software scales the reported height differently, but the order of merges is the same.

CENTROID LINKAGE

Distance between the cluster means. Needs Euclidean coordinates, and it can give inversions (a later merge lower than an earlier one).

AVERAGE-LINKAGE UPDATE AFTER MERGING A AND B

Weight the two old distances by cluster size. The plain average of and is wrong unless .

Where this was asked: 2024 (2), 2025 (1), 2026 (1). See the 4 previous-year questions on Clustering. This shows what was asked, not what will be asked.