Skip to content

RiskBands

Binning for credit risk with a focus on temporal robustness. RiskBands helps move from a static IV reading to a more defensible decision across separation, stability, and auditability.

RiskBands is a Python library for building, comparing, and auditing binning candidates when the real question is not only “which cut has the highest IV?”, but:

which solution remains more defensible when time becomes part of the analysis?

It was designed for cases such as:

  • PD models
  • credit scorecards
  • vintage or cohort analysis
  • variables with temporal drift
  • structures with rare bins, fragile coverage, or ranking reversals

OptimalBinning already solves static cuts very well. RiskBands helps decide whether that cut is still the best answer when behavior is opened by period.

In practice, the project adds:

  • temporal diagnostics by variable, bin, and period
  • a temporal-robustness-oriented score with the stable strategy
  • candidate comparison through BinComparator
  • auditable reports explaining why a candidate won
  1. Install the Python package.
  2. Run the Quickstart.
  3. Read Score and strategies to understand stable.
  4. Read Missing policy if your data contains missing values.
  5. Use Outputs and diagnostics to learn how to read the result.
  6. Continue with Examples or the methodology pages in the pt-BR documentation.
from riskbands import RiskBands
binner = RiskBands(
strategy="supervised",
score_strategy="stable",
max_n_bins=5,
check_stability=True,
missing_policy="standard",
)
binner.fit(df, y="target", column="score", time_col="month")
summary = binner.summary()
score_details = binner.score_details()

stable does not choose the best candidate only by static IV.

It combines:

  • temporal variance of shrunken WoE
  • drift between windows
  • ranking inversions between bins
  • separation
  • entropy
  • PSI

All of these are combined in a comparable minimization-oriented objective.