In order to group points into clusters, we need to know about their distance between each other.

## Intercluster & intracluster

**Intracluster distance**: Distance between two point in the same cluster.
**Intercluster distance**: Distance between two points in the different clusters.

*An illustraction of intercluster and intracluster distance.*

<aside>
☝ Best clustering → min intracluster & max intercluster.

</aside>

## Distances used

### Intracluster types

**Intracluster** -- Measuring distance between points in a cluster.

🔅 **Complete Diameter Distance**: the farthest distance between two points in a cluster.

$$
\delta (S) = \max_{x, y\in S} d(x,y)
$$

🔅 **Average Diameter Distance**: the average distance between ALL points in a clusters.

$$
\delta (S) = \dfrac{1}{\vert S\vert (\vert S\vert-1)} \sum_{x, y\in S, x\ne y} d(x,y)
$$

where $\vert S\vert$ is the number of points in $S$.

🔅 **Centroid Diameter Distance**: the double of average distance between points and the center of a cluster.

$$
\delta (S) = 2 \left( \dfrac{\sum_{x\in S}d(x, c_S)}{\vert S\vert} \right)
$$

where $c_S$ (can be calculated as $\frac{\Sigma_{x\in S}x}{\vert S\vert}), \vert S\vert$ are the center and the number of points in $S$.

### Intercluster types

**Intercluster** -- Measuring distance between 2 clusters. They can be used in Agglomerative clustering.

<div class="columns-2" markdown="1">
<div>

🔅 **Single Linkage Distance**: the closest distance between two objects in 2 clusters.

$$
\delta (S, T) = \min_{x\in S, y\in T} d(x,y)
$$