--- id: optbinning version: "0.21.0" license: Apache Licence 2.0 license_treatment: permissive maintenance: aging --- # optbinning — OptBinning: The Python Optimal Binning library License: permissive · Maintenance: aging · Downloads: 298.8K/mo ## What it is and what it does OptBinning is a Python library that solves the optimal binning problem—finding the best way to discretize a continuous or discrete numeric variable into bins to maximize predictive power or meet other objectives with respect to a target variable. It uses rigorous mathematical programming to handle binary, continuous, and multiclass targets, and incorporates constraints that go beyond simpler binning approaches. The library depends on numpy, scipy, scikit-learn, pandas, matplotlib, ortools, and ropwr. It is designed for data scientists and researchers working on feature engineering, model preprocessing, and statistical analysis where controlled discretization of variables is needed. Use it for: - Feature engineering in credit risk or classification models where binned variables improve interpretability and model performance. - Discretizing continuous predictors in logistic regression or tree-based models with explicit constraints on bin counts or monotonicity. - Exploratory data analysis to find natural or optimal breakpoints in a variable's relationship to a target outcome. - Preprocessing for regulatory or compliance requirements that demand human-interpretable variable bins with documented thresholds. ## Worth the install? AI-flagged interpretation of the facts above — verify before relying. OptBinning discretizes numeric variables into bins optimally for binary, continuous, and multiclass targets using mathematical programming, with support for constraints. Yes, if you need principled optimal binning with constraint support for feature engineering. The low install friction, permissive license, and active (though aging) maintenance make it a solid choice. However, verify that its mathematical programming approach and dependency footprint fit your performance and deployment constraints before committing to production use. ## Install pip install optbinning uv add optbinning poetry add optbinning ## Installing optbinning Before you install: Low install friction with a pure-wheel distribution. Maintenance status is aging—last commit was 292 days ago—but the repository remains active and not archived, with steady community interest (531 stars). License in practice: Distributed under Apache 2.0 (permissive), allowing commercial and private use with minimal restrictions; you must retain license and copyright notices. Quickstart: pip install optbinning import optbinning # Requires numpy, scipy, scikit-learn, pandas, matplotlib, ortools, ropwr as runtime dependencies Verify before relying: - Whether the mathematical programming formulation scales to very large datasets or high-dimensional problems. - Performance characteristics and typical runtime for common binning scenarios. - Specific constraint types supported beyond what the description excerpt mentions. ## Package facts - License: Apache Licence 2.0 (permissive) - Python support: supports_current - Install friction: low - Maintenance: aging - Downloads: 298.8K/month (top 15,000 on PyPI) - Known vulnerabilities: none known ## Tags optimal binning discretization, variable binning python, optimal discretization target, binning constraints optimization, continuous target binning, multiclass binning algorithm, mathematical programming binning, feature-engineering, discretization, optimization [View on SkillFed](https://skillfed.io/packages/optbinning) · [View on PyPI](https://pypi.org/project/optbinning/)