SPSS command: SPSS OPTIMAL BINNING

Optimal binning (MDLP) in your browser

Optimal Binning cuts a scale variable into bins that best separate the categories of a guide variable, such as default versus repaid.

Free · No account · Files stay on your device · Updated 18 October 2026

What it tells you

Crosstabs implements the SPSS OPTIMAL BINNING procedure with supervised MDLP (Fayyad and Irani), optional merging of sparse bins, and an unsupervised equal-frequency alternative.

  • Where to cut a continuous variable so the bins differ most in the guide outcome, and how many bins the data support.
  • The count of each guide category in every bin, so you can read off the outcome rate per bin.
  • The model entropy in bits: lower means the bins separate the guide categories better.
  • When no cut is justified: MDLP keeps the variable in one bin if no split improves prediction enough.

When to use it

Use it when

  • Scorecards and risk models where a continuous predictor should become a few interpretable bands.
  • Preparing a predictor for a decision tree, Naive Bayes or crosstab that needs categories.
  • Equal-frequency groups when there is no outcome to guide the cuts.

Use something else when

  • When you will test the binned variable against the same outcome on the same data: the cuts were chosen to fit it, so p values are too optimistic.
  • When the continuous variable itself fits the model well: binning throws information away.

How to run it in Crosstabs

  1. 01

    Open your data

    Open a .sav, CSV or Excel file in the workspace and switch to Statistics mode.

  2. 02

    Choose Optimal Binning

    In the Utilities and charts group pick Optimal Binning and choose the Variable to bin (scale).

  3. 03

    Choose the method

    Method: Supervised (MDLP) needs a Guide variable (categorical) and offers Merge sparse bins (5% threshold); Unsupervised (equal frequency) asks for the Number of bins.

  4. 04

    Run and download

    Declare an active weight (only frequency weights are used), press Run, read the Binning Summary, then Download data with binned variable (CSV), which adds <variable>_bin.

Worked example

Computed by the Crosstabs engine from the synthetic data below when this page was built — not typed in.

Data

300 synthetic loan applicants with income (thousands) and an outcome of default or repaid. The default rate is built to step down at about 32 and 58, and the engine has to find those steps without being told.

Binning Summary (Supervised MDLP, guide: outcome)
BinLower end (>)Upper end (≤)defaultrepaidTotalDefault rate
1−∞31.936205664.3%
231.957.018739119.8%
357.0+∞41491532.6%

Model entropy: 0.4822 bits. 300 cases used.

Binning Summary (Unsupervised, 4 equal-frequency bins)
BinLower end (>)Upper end (≤)Total
1−∞37.076
237.058.074
358.079.975
479.9+∞75

How to read it

MDLP split income into 3 bins at 31.9 and 57.0, close to the built-in steps, and the default rate falls from 64.3% in the first bin to 2.6% in the last. Equal-frequency binning ignores the outcome and simply cuts at the quartiles (37.0, 58.0, 79.9), so its bins do not line up with where risk changes.

Output tables explained

Binning Summary
One row per bin with its lower end (>) and upper end (≤), the count of each guide category and the total; footnotes give the model entropy and the number of cases used.
Optimal Binning
The summary line states how many bins were formed and the cut points, or that no cut point improves prediction enough.

Assumptions and notes

  • A bin holds values greater than its lower end and at most its upper end; cases missing the variable or the guide are not binned.
  • With more than 1,000 distinct values, values are pre-binned by equal frequency before MDLP, as in SPSS.
  • Frequency weights are rounded to whole numbers and weights below 0.5 drop the case; a sampling weight is ignored.

How the results are validated

Cut points are checked against an independent Python reference, which contains a separate MDLP implementation (Fayyad and Irani) and the worked example printed in the SPSS OPTIMAL BINNING documentation. Cut points match to 1e-12, and bin counts per category and model entropy match to 1e-12, for the manual example, four random datasets and equal-frequency binning with 3, 4 and 7 bins. Validation evidence

Questions

Why did MDLP give me only one bin?

MDLP accepts a cut only when the information gain beats a minimum-description-length penalty. With a weak relationship or few cases, no cut passes, which is a useful finding in itself.

What does merging sparse bins do?

After MDLP, a bin whose size is below 5% of its smaller neighbour's is merged into whichever neighbour gives the lower class entropy. This avoids tiny bands that would be unstable in a new sample.

How is this different from Visual Binning or NTILES?

Equal-frequency or equal-width bins ignore the outcome. MDLP places cuts where the guide variable changes, so bins align with differences in risk or response.

Can the guide have more than two categories?

Yes. Any categorical guide works; the Binning Summary shows one count column per category.

Run Optimal Binning on your own data

Open a .sav, CSV or Excel file. Everything runs in your browser; the file never leaves your device.

Open the workspace

SPSS is a trademark of IBM Corp. Crosstabs is not affiliated with or endorsed by IBM.