guillermo-navas-palencia/optbinning

Optimal binning: monotonic binning with constraints. Support batch & stream optimal binning. Scorecard modelling and counterfactual explanations.

What it solves

OptBinning provides a rigorous mathematical approach to the "optimal binning" problem. It helps data scientists discretize continuous variables into bins that maximize the relationship with a target variable (binary, continuous, or multiclass) while adhering to specific constraints, which is a critical step in building interpretable models like scorecards.

How it works

The library uses mathematical programming formulations (including constraint programming solvers) to find the best split points for variables. It can handle 1D and 2D binning and supports various target types. Once binned, it can transform data into metrics like Weight of Evidence (WoE) or event rates. It also integrates with estimators to create scorecards, where binned variables are assigned points based on their contribution to the target prediction.

Who it’s for

It is designed for data scientists and ML engineers, particularly those working in credit scoring or other regulated industries where model interpretability, monotonicity, and rigorous feature engineering are required.

Highlights

  • Flexible Target Support: Works with binary, continuous, and multiclass targets.
  • Advanced Binning: Supports 1D and 2D optimal binning, as well as piecewise binning.
  • Scorecard Integration: Ability to build full scorecards with scaling and point assignment.
  • Specialized Handling: Includes support for streaming data, batch processing, and handling of missing or special values.
  • Interpretability Tools: Provides detailed binning tables, statistical analysis (Gini, IV, JS divergence), and counterfactual explanations.

Related

  • Project
  • Project
  • Project
  • Project
  • Project