Skip to content
Back to skills

Davies Bouldin Score

ASecurity

Compute the davies_bouldin_score metric — provided by scikit-learn. Use when the user has predictions and ground-truth and needs to compute davies_bouldin_score, or asks how to score with davies_bouldin_score.

  • 3 stars
  • 0 votes
  • 0 copies
  • 2 views
  • Added September 11, 2026
documentationpython

Security analysis

A100/100

Scanned September 11, 2026

npx -y skills add qhjqhj00/research-skills-pool --skill davies-bouldin-score --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Davies Bouldin Score?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Davies Bouldin Score
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/qhjqhj00-davies-bouldin-score/badge)](https://www.skillsdirectory.com/skills/qhjqhj00-davies-bouldin-score)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: davies-bouldin-score
description: Compute the davies_bouldin_score metric — provided by scikit-learn. Use when the user has predictions and ground-truth and needs to compute davies_bouldin_score, or asks how to score with davies_bouldin_score.
metadata:
  skill_kind: metric
  source_lib: scikit-learn
  import_path: sklearn.metrics.davies_bouldin_score
  source: library_introspection
---

# davies-bouldin-score

> Metric `davies_bouldin_score` from `scikit-learn` (sklearn.metrics.davies_bouldin_score)

## When to invoke this skill

The user has predictions + ground truth and asks to evaluate with davies_bouldin_score, or
mentions `sklearn.metrics.davies_bouldin_score` directly, or wants the standard scikit-learn implementation.

## Reference signature

```python
from sklearn.metrics import davies_bouldin_score

# davies_bouldin_score(X, labels)
```

## Library docstring

```
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 :ref:`User Guide <davies-bouldin_index>`.

.. versionadded:: 0.20

Parameters
----------
X : array-like of shape (n_samples, n_features)
    A list of ``n_features``-dimensional data points. Each row corresponds
    to a single data point.

labels : array-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"
   <https://ieeexplore.ieee.org/document/4766909>`__.
   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...
```

## Quick recipe

```python
import sklearn.metrics as _m
score = _m.davies_bouldin_score(y_true, y_pred)
```

## Don'ts

- Don't reimplement when the library version handles edge cases (NaN, ties, empty inputs) better than a hand-rolled formula.
- Always check the library version's argument order — sklearn is `(y_true, y_pred)` while torchmetrics is `(preds, target)`.

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.