Optimal Decision Trees for Interpretable and Constrained Clustering

Pouya Shati, Yuliang Song, Eldan Cohen, Sheila A. McIlraithJAIR 2025 · DOI

Abstract

Clustering is a fundamental task in data analysis, yet traditional methods often lack interpretability and the ability to incorporate domain-specific constraints. This paper presents a novel exact combinatorial optimization framework for building optimal decision trees for constrained clustering. By utilizing a MaxSAT encoding and a "Smart Pairs" pruning algorithm, the proposed approach generates human-interpretable rules while adhering to pairwise "must-link" and "cannot-link" constraints. Experimental results demonstrate that this method outperforms existing mathematical programming baselines in both solution quality and computational efficiency.

Introduction

In high-stakes domains such as medicine and market analysis, the utility of clustering is often limited by the "black-box" nature of popular algorithms like k-means or deep learning models. These methods group data points effectively but fail to provide an explicit rationale for their decisions. Decision trees offer a natural solution by providing clear, hierarchical rules. However, existing decision tree clustering methods struggle to integrate domain knowledge in the form of constraints and often lack theoretical guarantees on optimality.

This research addresses the challenge of finding a decision tree that is optimal according to a bi-criteria objective: minimizing the maximum distance within clusters (diameter) and maximizing the minimum distance between clusters (split). Crucially, the framework supports user-defined pairwise constraints, ensuring that the resulting clusters align with expert knowledge.

Methodology

The core of the proposed framework is a formulation of the clustering problem as a Maximum Satisfiability (MaxSAT) instance. Several technical innovations enable this approach to scale and handle complex data:

  1. Direct Numerical Encoding: Unlike traditional SAT approaches that require pre-binarization of data, this method encodes numerical features directly. This allows the solver to dynamically determine optimal split thresholds during the optimization process.
  2. ε-Approximation: To manage the computational complexity associated with continuous distance values, the authors introduce "distance classes." This technique ensures that the resulting solution is within a guaranteed ε of the true Pareto optimal front for the diameter and split objectives.
  3. Smart Pairs Algorithm: Pairwise constraints and objectives typically scale quadratically ($O(N^2)$), which can be prohibitive for large datasets. The "Smart Pairs" algorithm leverages graph theory to identify and prune redundant or infeasible constraints during the encoding phase, significantly reducing the search space.
  4. Soft Constraint Schemes: To handle noisy or contradictory expert constraints, the framework includes 1-stage, 2-stage, and 3-stage optimization schemes. These prioritize the satisfaction of the maximum number of constraints before optimizing the primary clustering objectives.
  5. Pareto Front Exploration: The framework provides an iterative algorithm to identify all non-dominated solutions, allowing practitioners to select the most appropriate trade-off between cluster tightness (diameter) and separation (split).

Experimental Evaluation

The framework was evaluated on 11 datasets, including real-world data from the UCI Repository (e.g., Iris, Wine, Spam) and synthetic datasets from the Fundamental Clustering Problem Suite (FCPS). These datasets were selected to test the algorithm's performance on informative features and complex geometric shapes.

Key Results

The proposed MaxSAT approach consistently outperformed baselines, such as the Mixed-Integer Programming (MIP) formulation by Bertsimas et al. In many instances, the MIP baseline failed to find a feasible solution within the time limit, whereas the SAT-based approach succeeded.

The impact of constraints was particularly notable. Even a small number of constraints (e.g., κ = 0.1) led to significant improvements in clustering accuracy. For instance, on the Wine dataset, the Adjusted Rand Index (ARI) increased from near zero to over 0.7 with minimal constraints. Furthermore, the "Smart Pairs" pruning was found to be essential for maintaining performance on larger datasets like Spam (4,601 instances).

Discussion and Insights

A significant finding of this work is that decision trees can act as effective regularizers. Tree-based clustering often achieved higher ARI scores than non-tree constrained clustering methods. The inherent hierarchical structure of the tree prevents the formation of "messy" clusters that might otherwise overfit the data.

However, there is an inherent trade-off between interpretability and feasibility. Shallow trees have limited capacity to satisfy a large number of constraints. The paper's soft-constraint approach is vital in these scenarios, allowing the model to find the best possible fit given the structural limitations of the tree.

Conclusion and Future Work

This paper introduces the first exact combinatorial approach for optimal decision trees in constrained clustering. While the method is significantly faster than previous exact techniques, scalability to extremely large datasets or very deep trees remains a challenge. Future research could explore more sophisticated graph-based pruning or extend the encoding to optimize other metrics, such as the Within-Cluster Sum of Squares (WCSS). Additionally, automating the selection of tree depth to balance interpretability with accuracy would be a valuable extension.

Reference: Shati, P., Song, Y., Cohen, E., & McIlraith, S. A. (2025). Optimal Decision Trees for Interpretable and Constrained Clustering. Journal of Artificial Intelligence Research, 84, Article 4.

Summary updated

BibTeX
@article{shati2025optimal,
  author = {Pouya Shati and Yuliang Song and Eldan Cohen and Sheila A. McIlraith},
  title = {{Optimal Decision Trees for Interpretable and Constrained Clustering}},
  journal = {J. Artif. Intell. Res.},
  year = {2025},
  doi = {10.1613/jair.1.18144},
}
Figure