Optimal Classification Trees for Continuous Feature Data Using Dynamic Programming with Branch-and-Bound

Catalin E. Brita, Jacobus G. M. van der Linden, Emir Demirovic

TL;DR

ConTree is a dynamic programming with branch-and-bound (DP+BnB) algorithm that builds provably optimal classification trees directly on continuous features without requiring data binarization. By exploiting sorted numeric data to perform $O(1)$ similarity-based lower-bounding and incorporating an efficient depth-two subroutine, ConTree runs one to two orders of magnitude faster than existing exact methods and scales to depth-four trees on standard benchmarks.

What Problem Does This Paper Address?

Decision trees are favored in high-stakes domains for their interpretability. However, learning an Optimal Decision Tree (ODT)—a tree of constrained size that provably minimizes training misclassifications—is NP-hard.

Greedy heuristics like CART and C4.5 scale well by optimizing split quality locally at each node, but they often yield suboptimal accuracy and unnecessarily large trees. Meanwhile, exact methods (based on SAT, Mixed-Integer Programming, or specialized Dynamic Programming) face serious scalability bottlenecks with continuous features. They typically force practitioners to choose between two bad options:

  1. Coarse binarization, which drastically degrades tree optimality.
  2. Exhaustive binarization (a binary feature for every unique threshold), which causes exponential blowups in memory and runtime.

Until now, the only dedicated exact method processing raw numeric data directly was Quant-BnB, but its quantile-splitting mechanism struggled to scale beyond depth-three trees.

Methods

ConTree builds trees using dynamic programming with branch-and-bound, recursively evaluating candidate splits along sorted continuous features. Its speedups stem from several key algorithmic innovations:

  • Sorted-Feature Similarity Lower Bounding (SLB): Prior discrete SLB methods require $O(n)$ bitwise operations to measure sample overlap between subproblems. ConTree observes that for sorted continuous features, the number of samples shifting between left and right branches is simply the index difference $|z(\tau) - z(\tau')|$, computable in $O(1)$.
  • Three Dedicated Pruning Operators:
  • Neighborhood Pruning (NB): Eliminates candidate thresholds adjacent to an evaluated threshold if the bound proves they cannot beat the current upper bound ($UB$).
  • Interval Shrinking (IS): Uses boundary solutions and zero-error subtrees (Theorem 2) to tighten active threshold intervals.
  • Sub-interval Pruning (SP): Discards an entire range of candidate thresholds $[i..j]$ if the sum of lower bounds from outside brackets exceeds $UB$.
  • Fast Depth-Two Subroutine (D2Split): Demirović et al. (2022) used a depth-two solver that consumed memory quadratic in the number of features—prohibitive for continuous thresholds. ConTree sorts the data once upfront and traverses features incrementally, evaluating all possible 4-leaf configurations for depth-two trees in $O(|D||F|)$ time without quadratic memory overhead.
  • Bounded Suboptimality (max-gap): Allows users to trade exact optimality for massive speedups by guaranteeing the returned tree is within a user-specified margin (e.g., $\le 1\%$) of the global optimum.

Datasets

The authors evaluated ConTree on 16 continuous-feature benchmark datasets from the UCI Machine Learning Repository: Avila, Bank, Bean, Bidding, EEG, Fault, HTRU, Magic, Occupancy, Page, Raisin, Rice, Room, Segment, Skin, and Wilt. Datasets range up to ~196,000 instances and 27 continuous attributes. No synthetic datasets were introduced.

Key Insights and Ideas

  • Sorting transforms lower-bound verification: Evaluating similarity bounds via binary search over sorted thresholds takes $O(\log m)$ rather than iterating over instances, turning pruning into an almost zero-overhead operation.
  • Interval pruning is remarkably aggressive: Sub-interval pruning alone prunes 99.6% of depth-two recursive calls on average.
  • Proving optimality dominates runtime: Anytime performance plots reveal that ConTree discovers near-optimal trees very early in the search; the vast majority of the execution budget is spent formally proving that no better tree exists.
  • Preserving order across splits: Because axis-aligned splits preserve the relative ordering of continuous variables, depth-two leaf class tallies can be maintained via prefix sums during a single linear scan.

Key Results

  • Pruning and Depth-Two Subroutine Speedups: The three pruning rules eliminate an average of 99.6% of candidate split calls. The dedicated D2Split subroutine accelerates depth-two tree construction by a factor of 320× (geometric mean) compared to a naive recursive baseline.
  • Depth-Two Benchmarks: ConTree solved all 16 datasets in $\le 0.3$ seconds. By comparison, MIP approaches (OCT, RS-OCT) and SAT solvers generally hit the 4-hour timeout with large optimality gaps remaining or ran out of memory.
  • Depth-Three Scalability: ConTree outperformed Quant-BnB by a geometric mean factor of 63× (up to 266× faster on the Fault dataset).
  • Depth-Four Scalability: Quant-BnB cannot handle depth-four trees. ConTree solved 12 of the 16 datasets to provable optimality within 4 hours. With a $1\%$ optimality gap tolerance, runtimes dropped from thousands of seconds to seconds or fractions of a second.
  • Generalization Performance: Trees trained with ConTree achieved on average 5% higher out-of-sample test accuracy than CART heuristics and 0.7% higher than optimal trees trained on coarsely binarized data.

Limitations and Future Work

  • Scaling to Deeper Trees: Despite orders-of-magnitude improvements, scaling beyond depth 4–6 remains prohibitive for larger datasets due to the combinatorial nature of NP-hard tree induction (e.g., 4 datasets timed out at depth 4).
  • Feature Scope: The current implementation supports axis-aligned binary splits on continuous data, but does not natively handle categorical features via subset branching (power sets).
  • Task Scope: The paper focuses solely on classification; regression trees are not currently supported.
  • Future Directions: Incorporating explicit tree-complexity penalties (e.g., node count limits or sparsity regularization), branching on categorical subsets, and adapting continuous regression bounds.

Summary updated

BibTeX
@inproceedings{brita2025optimal,
  author = {Catalin E. Brita and Jacobus G. M. van der Linden and Emir Demirovic},
  title = {{Optimal Classification Trees for Continuous Feature Data Using Dynamic Programming with Branch-and-Bound}},
  booktitle = {AAAI Conference on Artificial Intelligence},
  year = {2025},
  url = {https://openreview.net/forum?id=h5sAlMACZg},
}

Loading related content...

Figure