sklearn.metrics.davies_bouldin_score

sklearn.metrics.davies_bouldin_score(X, labels)[source]

Compute the Davies-Bouldin score.

The score is defined as the average similarity measure of each cluster with its most similar cluster, where similarity is the ratio of within-cluster distances to between-cluster distances. Thus, clusters which are farther apart and less dispersed will result in a better score.

The minimum score is zero, with lower values indicating better clustering.

Read more in the User Guide.

New in version 0.20.

Parameters:
Xarray-like of shape (n_samples, n_features)

A list of n_features-dimensional data points. Each row corresponds to a single data point.

labelsarray-like of shape (n_samples,)

Predicted labels for each sample.

Returns:
score: float

The resulting Davies-Bouldin score.

References

[1]

Davies, David L.; Bouldin, Donald W. (1979). “A Cluster Separation Measure”. IEEE Transactions on Pattern Analysis and Machine Intelligence. PAMI-1 (2): 224-227

Examples

>>> from sklearn.metrics import davies_bouldin_score
>>> X = [[0, 1], [1, 1], [3, 4]]
>>> labels = [0, 0, 1]
>>> davies_bouldin_score(X, labels)
0.12...