Enter the distances between clusters and the distances between data points within the same cluster into the calculator to determine the Dunn Index.

## Dunn Index Formula

The following formula is used to calculate the Dunn Index.

DI = min{min{d(i, j) / max{d(k, l)}}}

Variables:

- DI is the Dunn Index d(i, j) is the distance between clusters i and j
- d(k, l) is the distance between data points k and l within the same cluster

To calculate the Dunn Index, find the minimum distance between clusters (d(i, j)) and divide it by the maximum distance between data points within the same cluster (d(k, l)). The Dunn Index is the minimum value of these ratios. This index is used to evaluate the quality of a clustering algorithm: the larger the Dunn Index, the better the clustering result.

## What is a Dunn Index?

The Dunn Index is a metric used in data analysis for determining the compactness and separation of clusters in a data set. It calculates the ratio between the smallest distance between observations not in the same cluster to the largest intra-cluster distance. A higher Dunn Index indicates better clustering, as it signifies that clusters are compact (observations within the same cluster are close to each other) and well-separated (observations in different clusters are far apart).

## How to Calculate Dunn Index?

The following steps outline how to calculate the Dunn Index.

- First, determine the distance between clusters i and j (d(i, j)).
- Next, determine the distance between data points k and l within the same cluster (d(k, l)).
- Next, find the maximum value of d(k, l) among all data points within the same cluster.
- Next, find the minimum value of d(i, j) among all pairs of clusters.
- Finally, calculate the Dunn Index using the formula DI = min{min{d(i, j) / max{d(k, l)}}}.

**Example Problem : **

Use the following variables as an example problem to test your knowledge.

d(i, j) = 5

d(k, l) = 2