ClusterDunnIndex: Dunn Index

View source: R/ClusterDunnIndex.R

ClusterDunnIndexR Documentation

Dunn Index

Description

Calculates the internal Dunn cluster-validity index for a given clustering [Dunn, 1974]. No prior classification is required.

Usage

ClusterDunnIndex(Cls,DataOrDistances,

DistanceMethod="euclidean",Silent=TRUE,Force=FALSE,...)

Arguments

Cls

A numerical vector of length n defining the classification. It has k unique values representing the arbitrary cluster labels.

DataOrDistances

Either a [1:n,1:d] data matrix containing n observations and d variables, or a symmetric [1:n,1:n] dissimilarity matrix. For a data matrix, pairwise distances are calculated using DistanceMethod.

DistanceMethod

Optional distance method passed to parallelDist::parDist() or, when parallelDist is unavailable, to stats::dist(). The default is "euclidean".

Silent

Logical scalar. If TRUE, suppresses the informational message printed when distances must be calculated from a data matrix.

Force

Logical scalar. If TRUE, computes the ratio even when the maximum within-cluster distance is near zero, using machine precision as the minimum denominator.

...

Further arguments passed to parallelDist::parDist(), for example a user-defined distance function.

Details

The Dunn index is defined as min(InterDist) / max(IntraDist). Well-separated clusters usually have a Dunn index above 1; see [Dunn, 1974] for details.

Value

A list with the following components:

Dunn

A numeric scalar containing the Dunn index.

IntraDist

A numerical vector of length k containing the maximum within-cluster distance for each cluster.

InterDist

A numerical vector of length k containing the minimum between-cluster distance for each cluster.

Author(s)

Michael Thrun

References

[Dunn, 1974] Dunn, J. C.: Well-separated clusters and optimal fuzzy partitions. Journal of Cybernetics, Vol. 4(1), pp. 95-104, 1974.

Examples

data("Hepta")
Cls <- kmeansClustering(
  Hepta$Data,
  ClusterNo = 7,
  Type = "Hartigan"
)$Cls
ClusterDunnIndex(Cls, Hepta$Data)


ClsWellSeparated <- kmeansClustering(
  Hepta$Data,
  ClusterNo = 7,
  Type = "Steinley"
)$Cls
ClusterDunnIndex(ClsWellSeparated, Hepta$Data)


FCPS documentation built on Oct. 3, 2026, 9:06 a.m.