[Paper Review] Optimal binning: mathematical programming formulation
This paper presents a novel convex mixed-integer programming formulation for optimal binning that supports binary, continuous, and multi-class targets with rigorous handling of constraints like monotonicity and minimum bin size. It achieves optimal solutions via mathematical programming, outperforming heuristic methods in speed and quality, especially with complex monotonic trends, and is implemented in the open-source OptBinning library.
The optimal binning is the optimal discretization of a variable into bins given a discrete or continuous numeric target. We present a rigorous and extensible mathematical programming formulation for solving the optimal binning problem for a binary, continuous and multi-class target type, incorporating constraints not previously addressed. For all three target types, we introduce a convex mixed-integer programming formulation. Several algorithmic enhancements, such as automatic determination of the most suitable monotonic trend via a Machine-Learning-based classifier and implementation aspects are thoughtfully discussed. The new mathematical programming formulations are carefully implemented in the open-source python library OptBinning.
Motivation & Objective
- To develop a rigorous, extensible mathematical programming formulation for optimal binning across multiple target types.
- To address constraints not previously handled in optimal binning, including monotonicity, minimum bin size, and maximum p-value for continuous targets.
- To enable automatic detection of optimal monotonic trends using a machine learning-based classifier.
- To provide a scalable solution for large datasets through algorithmic enhancements and efficient solver integration.
- To close the gap between open-source and commercial optimal binning tools by offering a comprehensive, production-ready implementation.
Proposed method
- Formulates optimal binning as a convex mixed-integer program (MIP), with integer linear (ILP) and quadratic (MIQP) variants depending on constraints.
- Uses a pre-binning step based on decision trees to generate initial split points, creating n pre-bins from m split points.
- Employs a binary lower-triangular matrix X_ij as decision variables to represent bin merging, starting from a diagonal (all pre-bins selected).
- Incorporates constraints such as minimum and maximum bin size, monotonicity (ascending, descending, peak, valley), and maximum p-value for continuous targets.
- Introduces a machine learning classifier to automatically select the optimal monotonic trend (e.g., peak or valley) based on data patterns.
- Implements presolving algorithms and leverages modern solvers (Google OR-Tools, LocalSolver) to efficiently solve large-scale instances.
Experimental results
Research questions
- RQ1Can a unified mathematical programming formulation be developed to solve optimal binning for binary, continuous, and multi-class targets simultaneously?
- RQ2How can complex constraints such as monotonicity trends (including non-standard ones like peak/valley) be rigorously modeled in optimal binning?
- RQ3What is the impact of automatic monotonic trend detection via machine learning on solution quality and computational efficiency?
- RQ4How do modern MIP and local search solvers compare in performance for large-scale optimal binning problems?
- RQ5To what extent can algorithmic enhancements like presolving and solver-specific optimizations reduce solution time for real-world datasets?
Key findings
- The proposed formulation achieves optimal solutions for all target types—binary, continuous, and multi-class—using convex MIP, with solution quality and constraint handling significantly outperforming prior methods.
- For the peak monotonic trend, LocalSolver found the optimal solution in 5 seconds, 28x faster than CP-SAT, demonstrating superior performance on complex combinatorial structures.
- In a 100-pre-bin instance with a peak trend, LocalSolver reached the optimal solution in 30 seconds, while CP-SAT failed to find an optimal solution within 1000 seconds.
- The automatic monotonic trend detection via machine learning reduced resolution times substantially, especially for non-standard trends like peak or valley.
- The optimization problem was solved in 0.25 seconds for a continuous target, with most time spent on pre-processing (71%) for categorical variables.
- The open-source OptBinning library successfully implements the formulations, enabling reproducibility and integration into production workflows.
Read this paper
Open the full text in the Nubint reader and ask about any passage as you read.
Read this paper on NubintThis review was generated by AI from the original paper. Please check the paper before citing it.