Skip to content

Evaluation, diagnostics, benchmarks, and additional tests · Evaluation, diagnostics, benchmarks, and additional hypothesis tests · EVA003 · Metric

Davies–Bouldin index

Summarizes the worst relative overlap of each cluster with another cluster.

Runs in CodeSplash Complete calculation CodeSplash's run and the reference's record

In CodeSplash

A CodeSplash method runs this entry in Python and R. Set it up from the method's page.

Do it in CodeSplash Run it on your own data, in Python or R.

Availability
Runs in CodeSplash
Code example
Complete calculation
Who ran it
CodeSplash's run and the reference's record
CodeSplash's run
Verified in Python and R through discover.choose_k, discover.stability. The reference's example ran in Python and R here, and they agree.
The reference's record
Python: Ran in the reference's review. The report doesn't record which version of the code ran. R: Reviewed but not run: R wasn't available to the reference's authors.

Purpose

Summarizes the worst relative overlap of each cluster with another cluster.

Question / hypotheses

Are cluster radii small compared with the distances between their centroids? Lower is preferable.

Architecture / computational structure

A fixed scoring/calibration pipeline applied to model outputs or supplied observations; the formula and usage sections identify its operations.

Assumptions

Hard numerical clusters, a consistent distance convention, and distinct centroids are needed. The common implementation uses mean Euclidean distance to centroids.

Formula / computational definition

DB=k−1∑imax⁡j≠iSi+Sj∥μi−μj∥2.DB=k^{-1}\sum_i\max_{j\ne i}\frac{S_i+S_j}{\|\mu_i-\mu_j\|_2}.

Parameters and notation

S_i is mean distance within cluster i to its centroid mu_i; k is cluster count. The metric has no fitted parameters. Scaling and clustering hyperparameters determine the geometry being evaluated.

Fitting, fine-tuning, and adaptation

There is no model fine-tuning step for this evaluation procedure. Freeze the evaluated systems and evaluator before the final test. Select evaluation settings on development data; if a learned evaluator or calibration model is adapted, use separate fitting data, version it, and reassess its validity.

How to use and calibrate

Compare partitions on the same standardized features and inspect which pair creates each maximum. Combine with plots of cluster sizes and noisy observations.

Example application

Diagnose whether two topic-embedding clusters should be merged because their within-cluster spread dominates centroid separation.

Interpretation / pitfalls

Watch out

Nonconvex clusters and varying densities can be penalized despite meaningful structure. Very small clusters can distort comparisons; zero centroid distances need explicit handling.

Python and R code examples

Scope: Mathematical calculation on synthetic inputs; not a complete benchmark pipeline.

Validation: Python — Executed successfully on synthetic inputs. R — reviewed but not executed in this environment. Python dependencies are explicit imports; R uses base R unless a package/bridge is explicitly named.

Python and R

The reference's own programs, shown as written. A component demo shows one central piece of the method; it doesn't train a full model.

Python

Complete calculation — Mathematical calculation on synthetic inputs; not a complete benchmark pipeline. · needs numpy, sklearn

import numpy as np
from sklearn.metrics import davies_bouldin_score
X=np.array([[0.,0.],[0.,1.],[1.,0.],[8.,8.],[8.,9.],[9.,8.]])
print(davies_bouldin_score(X,[0,0,0,1,1,1]))
R

Complete calculation — Mathematical calculation on synthetic inputs; not a complete benchmark pipeline.

X <- rbind(c(0,0),c(0,1),c(1,0),c(8,8),c(8,9),c(9,8)); g <- c(1,1,1,2,2,2)
centers <- rbind(colMeans(X[g==1,]),colMeans(X[g==2,]))
s <- sapply(1:2,function(j) mean(sqrt(rowSums(sweep(X[g==j,,drop=FALSE],2,centers[j,])^2))))
print(sum(s)/sqrt(sum((centers[1,]-centers[2,])^2)))

Sources

From the CodeSplash reference, entry EVA003.