SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2001.08025 · 2020

Optimal binning: mathematical programming formulation

arXiv · PDF · Open in the Atlas

Code that ran

5 of 5 samples (functions and classes) lifted from this paper's linked repositories executed on a synthesized input in Syntology's jail (0 of them constructed an object rather than computing a result; 0 honoured the contract we drafted, 0 violated it and 5 have no contract verdict; 0 failures of our instrument; 0 no recorded run), measured 2026-11-21; repository links from the Papers with Code archive attributed under CC BY-SA, no affiliation; bodies inline only under a permissive licence as GitHub detects it. Not a reproduction of the paper's results.

"Ran" means the function executed on a synthesized input and returned a value. It is not a reproduction of the paper's results. This record, dated, as JSON: /api/ran/2001.08025.json · badge: /api/ran/2001.08025.svg

Each repository's role is a label: a classifier's output recorded on the link, or, where no role is recorded, what the Papers with Code archive marked. The line under it names its basis. Neither says who wrote the code.

RepositoryRoleRan
guillermo-navas-palencia/optbinning canonical (classifier label)
classifier basis: census
5 ran · 0 no recorded run
FunctionStatusWhere it lives
dataframe_to_string Ran
ran on a synthesized input
guillermo-navas-palencia/optbinning/optbinning/formatting.py
code served (permissive licence) · get_code("881783381f5be2fc")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned str. The image it ran in was not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import pandas as pd
import numbers
import textwrap

# Create a simple DataFrame with some sample data
df = pd.DataFrame({
    'Name': ['Alice', 'Bob', 'Charlie'],
    'Age': [25, 30, 35],
    'City': ['New York', 'London', 'Paris']
})

ARGS = {
    'df': df,
    'tab': 2
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
pandas — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type str — a str output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a str output the recorded ndim 0 and dtype family float describe that coercion, not the output, and are not stated
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
find_pvalue_violation_indices Ran
ran on a synthesized input
guillermo-navas-palencia/optbinning/optbinning/binning/model_data.py
code served (permissive licence) · get_code("81c04780deaee05a")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned list, ndim 3, dtype family int; no output shape is stated. The image it ran in was not recorded. If your copy returns the same type and ndim on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import numpy as np
from scipy import stats

# Analyze the function to understand what arguments are needed
# find_pvalue_violation_indices takes:
# - n: int (number of elements)
# - E: list[int] (but actually used as list of lists based on indexing E[i][r])
# - NE: list[int] (but actually used as list of lists based on indexing NE[i][r])
# - max_pvalue: float
# - max_pvalue_policy: str (either 'all' or 'consecutive')

# Looking at the indexing:
# - E[i][r] where i goes from 0 to n-1, r goes from 0 to i
# - E[j][k] or E[j][i+1]
# So E and NE are jagged lists (upper triangular structure)

n = 4

# Create jagged lists for E and NE
# E[i] has length i+1 for i in range(n)
E = []
NE = []
for i in range(n):
    E.append([np.random.randint(5, 20) for _ in range(i + 1)])
    NE.append([np.random.randint(5, 20) for _ in range(i + 1)])

max_pvalue = 0.05
max_pvalue_policy = 'all'

ARGS = {
    'n': n,
    'E': E,
    'NE': NE,
    'max_pvalue': max_pvalue,
    'max_pvalue_policy': max_pvalue_policy
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy, scipy — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type list, ndim 3, dtype family int — a list output has no array shape of its own; none is stated
dtype family
int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
find_pvalue_violation_indices_continuous Ran
ran on a synthesized input
guillermo-navas-palencia/optbinning/optbinning/binning/model_data.py
code served (permissive licence) · get_code("ecf040367e67f014")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned list, ndim 1, dtype family float; no output shape is stated. The image it ran in was not recorded. If your copy returns the same type and ndim on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import numpy as np

ARGS = {
    'n': 3,
    'U': [
        [1.0, 2.0, 3.0],
        [1.5, 2.5, 3.5],
        [2.0, 3.0, 4.0]
    ],
    'S': [
        [0.5, 0.6, 0.7],
        [0.55, 0.65, 0.75],
        [0.6, 0.7, 0.8]
    ],
    'R': [
        [10, 12, 15],
        [11, 13, 16],
        [12, 14, 17]
    ],
    'max_pvalue': 0.05,
    'max_pvalue_policy': 'all'
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy, scipy — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type list, ndim 1, dtype family float — a list output has no array shape of its own; none is stated
dtype family
int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
solver_statistics Ran
ran on a synthesized input
guillermo-navas-palencia/optbinning/optbinning/information.py
code served (permissive licence) · get_code("38d9c4230af0da04")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned tuple, ndim 1, dtype family float; no output shape is stated. The image it ran in was not recorded. If your copy returns the same type and ndim on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch
import numpy as np

torch.manual_seed(0)

# For 'cp' solver type - mock Google OR-Tools CP solver
class MockCPSolver:
    def NumBooleans(self):
        return 42
    
    def NumBranches(self):
        return 100
    
    def NumConflicts(self):
        return 5
    
    def ObjectiveValue(self):
        return 123.45
    
    def BestObjectiveBound(self):
        return 120.0
    
    def WallTime(self):
        return 1234  # milliseconds

# For 'mip' solver type - mock MIP solver
class MockObjective:
    def Value(self):
        return 456.78
    
    def BestBound(self):
        return 450.0

class MockMIPSolver:
    def NumConstraints(self):
        return 30
    
    def NumVariables(self):
        return 25
    
    def Objective(self):
        return MockObjective()

# For 'lp' solver type - mock LP solver
class MockLPSolver:
    def __init__(self):
        self.n_variables = 15
        self.n_constraints = 20
        self.n_iterations = 50
        self.objective = 789.01

# For 'ls' solver type - mock LocalSolver
class MockLSStatistics:
    @staticmethod
    def get_nb_iterations(stats):
        return 1000

class MockLSSolver:
    def __init__(self):
        self.statistics = None

# Create solver instances for testing
cp_solver = MockCPSolver()
mip_solver = MockMIPSolver()
lp_solver = MockLPSolver()
ls_solver = MockLSSolver()

# Test with 'cp' solver
ARGS = {
    'solver_type': 'cp',
    'solver': cp_solver
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy, torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type tuple, ndim 1, dtype family float — a tuple output has no array shape of its own; none is stated
dtype family
int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
test_proportions Ran
ran on a synthesized input
guillermo-navas-palencia/optbinning/optbinning/binning/model_data.py
code served (permissive licence) · get_code("25356bfaf043197e")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned bool, ndim 0, dtype family float, shape () as a later run recorded it. The image it ran in was not recorded. If your copy returns the same type, ndim and shape on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import numpy as np

# test_proportions performs a two-proportion z-test
# It takes:
# - e1: number of events in group 1 (int)
# - ne1: number of non-events in group 1 (int)
# - e2: number of events in group 2 (int)
# - ne2: number of non-events in group 2 (int)
# - zscore: critical z-score threshold (float)

# Set up reasonable values for a two-proportion z-test
ARGS = {
    "e1": 50,           # events in group 1
    "ne1": 150,         # non-events in group 1
    "e2": 45,           # events in group 2
    "ne2": 155,         # non-events in group 2
    "zscore": 1.96      # typical critical value for 95% confidence
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type bool, ndim 0, dtype family float, shape () — shape () as a later run recorded it
dtype family
int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block

Also present in other papers' code

Of 5 samples lifted from this paper's linked repositories, 5 carry a function identity and 0 do not. Of the 5 distinct functions with an identity, 0 are also present in other papers whose code we hold (0 with at least one paper dated earlier, 0 the same month, 0 later) and 5 are only here among the 52,977 papers whose code Syntology holds (as of 2026-09-26).

Only here means: among the 52,977 papers whose code Syntology holds (51,887 with lifted samples, 1,090 through their assemblies only), as of 2026-09-26, no other paper's lifted samples or current assembly bricks contain an identical function body after normalisation.

Presence, not direction: an identical function body in two papers' repositories does not say who wrote it, which came from which, or that either paper's method rests on it. Matching is exact after normalisation, so a renamed or edited function is not matched. Dates are when papers appeared, not when code was written. Only .py files the harvester lifted are covered; notebooks are not read. A new-style arXiv id YYMM.NNNN dates a paper to the month 20YY-MM; otherwise Paper.year dates it to the year; otherwise it is undated. Dates are when the paper appeared, not when the code was written. Read 2026-11-21.

Repositories linked to this paper

Some links come from the archived Papers with Code dataset (CC BY-SA 4.0): attribution and licence.

Abstract

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.

For agents

The same record, over MCP at https://syntology.ai/mcp:

get_harvested_code_for_paper("2001.08025")
get_code_for_paper("2001.08025")
have("2001.08025")

The run record, dated, one paper per request, free:

curl https://syntology.ai/api/ran/2001.08025.json

A badge for a README (the split and the date, never a ratio):

[![Syntology run record](https://syntology.ai/api/ran/2001.08025.svg)](https://syntology.ai/paper/2001.08025)

Connect an agent — have() is free.