Papers
Topics
Authors
Recent
Search
2000 character limit reached

ExDBSCAN: Explaining DBSCAN with Counterfactual Reasoning -- Additional Material

Published 28 May 2026 in cs.LG | (2605.30225v2)

Abstract: Clustering is an unsupervised technique for grouping data points by similarity. While explainability methods exist for supervised machine learning, they are not directly applicable to clustering, making it challenging to understand cluster assignments. This interpretability gap is particularly evident in the popular density-based method DBSCAN, which assigns points as inliers (cluster members in dense regions) or outliers (noise points in sparse regions). DBSCAN does not provide insight into why a particular point receives its assignment or whether its assignment is robust to small changes in the data. To address the lack of explainability, we introduce ExDBSCAN, a density-aware, post-hoc explanation method. ExDBSCAN offers actionable counterfactual explanations, with theoretical guarantees for validity. It generates multiple counterfactuals using a density connected weighted graph, adopting a physics-inspired model that repels counterfactual candidates from one another (diversity), while pulling them toward the instance to explain (proximity). Empirical evaluation on 30 tabular datasets comparing against four baselines shows that ExDBSCAN outperforms all baselines while attaining perfect validity and retrieving diverse, proximal counterfactuals.

Summary

  • The paper presents ExDBSCAN, a novel counterfactual explanation framework that generates valid actionable explanations for DBSCAN clustering.
  • It introduces a physics-inspired optimization balancing proximity and diversity, ensuring generated counterfactuals strictly adhere to DBSCAN's density-connectivity.
  • Experimental results across 30 OpenML datasets demonstrate ExDBSCAN’s superior performance in achieving perfect validity and robust counterfactual recourse.

ExDBSCAN: Counterfactual Explanations for Density-Based Clustering

Introduction

The paper "ExDBSCAN: Explaining DBSCAN with Counterfactual Reasoning -- Additional Material" (2605.30225) addresses the challenge of local explainability in density-based clustering, with a specific focus on DBSCAN. Unlike supervised learners, DBSCAN assigns points to clusters or labels them as noise based on density-connectivity, posing unique obstacles for existing counterfactual explanation (CE) frameworks, which generally rely on gradients, probabilities, or global prototypes. The absence of differentiable decision boundaries and continuous probabilities in DBSCAN precludes the direct use of most supervised CE methods for actionable interpretability.

Density-Connected Counterfactual Generation in DBSCAN

The core contribution is ExDBSCAN, a model-agnostic post-hoc explanation framework built to be inherently density-aware and valid by design with respect to DBSCAN cluster assignments. For a point of interest, ExDBSCAN generates a set of valid counterfactuals (CFs), each effecting a transition to a user-specified target cluster, either from another cluster or from the noise partition. These CFs strictly follow the DBSCAN density-connectivity structure, offering direct operational insight into the minimal changes necessary for membership transition.

ExDBSCAN’s cost function incorporates two competing terms: proximity (minimizing the change required, emphasizing plausibility and minimal intervention) and diversity (maximizing coverage and uniqueness among the returned CFs). Proximity is defined in terms of Euclidean distance (or the metric DBSCAN was fit on); diversity, in contrast, is computed via the weighted shortest-path—a measure reflective of density-reachability in the cluster core graph, capturing the topological and nonconvex geometry of density-based clusters. Figure 1

Figure 1: Manipulating the energy-based tradeoff between counterfactual proximity and diversity in cluster space.

A notable theoretical result is the validity guarantee: every generated CF lies within the ε\varepsilon-neighborhood of a core point in the target cluster, assuring its assignment is aligned with DBSCAN's connectivity and partitioning definition.

Physics-Inspired Optimisation Formulation

ExDBSCAN formalizes multi-counterfactual selection as a discrete energy minimization problem over the cluster’s core-point graph. The selected CFs are associated with reference core points, and the selection balances an attraction force (proximity to the explained sample, modelled as springs) and a repulsion force (pairwise diversity among selected reference cores, modelled as electrostatics). This approach leads to an NP-hard combinatorial optimization, approximated via a greedy iterative process that is nearly optimal as per the presented empirical results.

The energy functional for selecting kk CFs associated with core points C′C' is:

EC′=∑i<j1D(Vi,Vj)+∑id2(p,Vi)E_{C'} = \sum_{i<j} \frac{1}{\mathcal{D}(V_i, V_j)} + \sum_{i} d^2(p, V_i)

where D(Vi,Vj)\mathcal{D}(V_i, V_j) is the graph-based shortest-path (density-connected) distance, and d(p,Vi)d(p, V_i) is the Euclidean (or other DBSCAN-selected metric) distance from the explained instance to each reference core.

Evaluation Protocol and Strong Performance

The evaluation spans 30 OpenML tabular datasets with DBSCAN hyperparameters optimized per dataset. Baselines include model-agnostic Bayesian and genetic CE generators (BayCon), Direct/Surrogate-based DiCE and Growing Spheres, as well as a core-random selection method isolating the optimization’s effect. When surrogate models are involved, DBSCAN labels are taken as pseudo-classes due to the absence of inherent cluster probabilities.

Key metrics used are validity, proximity, and diversity:

  • Validity: Proportion of CEs assigned (by DBSCAN) to the target cluster.
  • Proximity: Mean Euclidean distance between original and CF.
  • Diversity: Determinantal Point Process (DPP)-based measure using density-connected cluster graph distances. Figure 2

    Figure 2: ExDBSCAN achieves perfect validity and superior proximity; surrogates and BayCon fail to align with DBSCAN assignments.

ExDBSCAN achieves 100% validity across all datasets and queries, while all surrogate-based or non-density-connected algorithms fail to reach 50%50\% on most benchmarks. In proximity, ExDBSCAN consistently produces CFs closer to the original sample than baseline and random methods, indicating successful optimization of the tradeoff. Figure 3

Figure 3: ExDBSCAN maximizes diversity while retaining perfect validity; alternative approaches lack cluster-structural awareness.

Diversity analysis shows ExDBSCAN's physics-inspired repulsion yields higher nonredundant coverage of the target cluster than all alternatives, and random selection demonstrates that diversity without structural optimization deteriorates proximity.

Robustness to Actionability and Constraints

ExDBSCAN readily accommodates non-actionable feature constraints by restricting movement across non-actionable subspaces or by core selection filtering. Empirical results with random subsets of non-actionable features reproduce the core findings: ExDBSCAN maintains perfect validity, proximity optimality, and substantially higher diversity, outperforming all baselines. Figure 4

Figure 4: Proximity/validity with non-actionable features—ExDBSCAN maintains perfect validity and low proximity.

Figure 5

Figure 5: Diversity is maximized by ExDBSCAN despite restricted actionable feature space.

The construction strategy for CFs in constrained subspaces assures continued validity, demonstrating practical utility in real-world decision and recourse applications, e.g., clinical or economic domains with immutable covariates.

Runtime and Complexity

While the energy minimization is NP-hard, empirical runtime is tractable for typical kk values (3–10), with ExDBSCAN showing competitive runtimes relative to alternatives except purely random core sampling methods. Greedy selection achieves near-optimal solutions, as supported by local search and mixed-integer programming verifications presented in the supplementary material. Figure 6

Figure 6: Runtime scales sub-quadratically with feature dimensionality and remains practical for high-dimensional settings.

Figure 7

Figure 7: Cumulative runtime distribution demonstrates ExDBSCAN’s efficiency.

Implications and Theoretical Advances

ExDBSCAN enables, for the first time, guaranteed valid actionable counterfactuals for DBSCAN and, by extension, for density-based algorithms lacking probabilities, distances to prototypes, or gradient structure. By adopting density-connected graph distances for diversity and cluster membership, it advances a framework equipped to handle the non-Euclidean, nonconvex geometry of density-based partitioning. Figure 8

Figure 8: Density-connected distances reveal crucial counterfactual diversity overlooked by Euclidean metrics in complex clusters.

Ablation studies confirm the complementarity of proximity and diversity, as well as the necessity of structure-aware (graph-based) distances in capturing true alternative explanations. Figure 9

Figure 9: Ablation shows ExDBSCAN and the nearest-core strategy yield optimal proximity.

Figure 10

Figure 10: Ablation further confirms best-in-class diversity for ExDBSCAN, particularly in aggregate queries.

Conclusion

ExDBSCAN introduces a theoretically-backed, structure-aware counterfactual explanation method for density-based clustering, with broad implications for the explainability of unsupervised learning. It achieves perfect validity, proximity, and diversity simultaneously, without relying on surrogate objectives or information not accessible in density-based models. The method is robust to domain constraints on actionability, scalable, and interpretable, and forms a model-agnostic template for future developments in explainable clustering. As unsupervised applications permeate high-stakes domains (anomaly detection, fraud, bioinformatics), ExDBSCAN provides vital operational recourse by bridging discrete, geometry-based reasoning with actionable explanations.

Future investigations may extend ExDBSCAN’s optimization with metaheuristic techniques, adapt it for online or streaming clustering, or generalize to other clustering paradigms with latent geometric assignment rules. The work delineates foundational principles for trustworthy, actionable unsupervised machine learning.

Paper to Video (Beta)

No one has generated a video about this paper yet.

Whiteboard

No one has generated a whiteboard explanation for this paper yet.

Open Problems

We haven't generated a list of open problems mentioned in this paper yet.

Collections

Sign up for free to add this paper to one or more collections.

Tweets

Sign up for free to view the 1 tweet with 6 likes about this paper.