From a classifier to Fisher-preserving bins
A signal fraction is to be estimated, the component densities are unknown, and labelled simulations are available. A calibrated classifier supplies the score and ScoreQuant bins it. How much of the information the bins report is real?
1. A mixture without a likelihood
Each event comes from signal or background, and the quantity to measure is the signal fraction :
In a realistic analysis neither component density can be evaluated: may be high-dimensional, and the components exist only as simulation. What is available is labelled simulated events, which is exactly what a classifier is trained on.
Here the components are two normal densities, and , and the reference signal fraction is 0.30. The fit pretends not to know them. Afterwards the exact densities give the exact score, and that oracle answers a question a real analysis cannot: when the bins report that they keep almost all the information, how much of that is true?
2. From classifier probabilities to a score
The score of a mixture depends on the data only through density ratios, and a classifier estimates density ratios.
A classifier trained on components mixed in proportions estimates the posterior , where is the training mixture. Dividing by the training proportion removes the prior:
The proportions to divide by are those of the training sample, not the fractions of the model. A classifier trained on balanced classes has whatever the signal fraction of the data.
The score is the derivative of the log density at , and it can be written in ratios alone:
The reason is simple: numerator and denominator are both linear in the densities, so a factor that multiplies every ratio of an event cancels. That freedom is the gauge. Ratios to the training mixture, as above, ratios to the background, with , and ratios to the reference density all give the same score, and no component density is ever needed on its own. The same cancellation holds with more components, in a normalized mixture and in a rate model whose coefficients float freely.
The gauge is free only if it is shared. Every ratio column of an event must carry the same factor : a signal ratio from a classifier, relative to the training mixture, placed beside an absolute background density from Monte Carlo gives a wrong score. ScoreQuant refuses such a mix when the providers declare their gauges, but the numbers alone cannot reveal it (user guide (opens in a new tab)). Nor can it check that the posteriors are calibrated, or that are the true training proportions.
DensityRatioScore.from_classifier performs both steps, the prior correction and the ratio-to-score map. It records the provider as an estimated ratio, so every result built on it is labelled supplied_score_surrogate, never exact_fisher (API guide (opens in a new tab)).
3. The experiment
The classifier is a logistic regression on and , trained on balanced samples of 15, 60 and 300 events per component. The exact log-ratio of two normal densities is quadratic in , so the model can represent it; only the amount of training data changes. Everything downstream stays fixed: the events the bins are fitted on, a held-out sample from the same reference mixture, and the budget of 4 bins. The data and the classifier come from the study code, examples/door3_classifier.py; the conversion is shown in full.
import numpy as np
import scorequant as sq
from examples.door3_classifier import (
draw_reference_mixture,
draw_training_mixture,
exact_provider,
make_features,
train_classifier,
)
train_observations = draw_reference_mixture(2026, 400)
test_observations = draw_reference_mixture(999, 600)
model = train_classifier(seed=101, n_per_class=15)
def posteriors(observations):
return model.predict_proba(make_features(np.asarray(observations)[:, 0]))
estimated = sq.ratios.DensityRatioScore.from_classifier(
posteriors,
[0.5, 0.5], # training proportions: balanced classes
sq.ratios.MixtureParameterization([0.3, 0.7]), # reference fractions, background last
)
quantizer = sq.fit_quantizer(
sq.ObservationSample(train_observations),
provider=estimated,
n_bins=4,
criterion=sq.DOptimality(),
config=sq.DExchangeConfig(seed=7),
)
assert quantizer.information_kind == "supplied_score_surrogate"
From the provider onward, fit_quantizer treats the estimated score like any other score. The larger training sizes change only the model line.
4. Reported versus achieved retention
The retention a fit reports is a ratio: the information the bins keep about a score, over that score's unbinned information. Both are computed from . The reason the report cannot see a bad classifier is simple: the bins are graded against the very score they were fitted to.
Here the exact score is also known, so the same bins can be graded twice. The held-out events are assigned with , as a real analysis would assign them, and the resulting labels are evaluated once against and once against the exact score :
estimated_scores = estimated.score(test_observations)
reported = quantizer.evaluate_scores(estimated_scores).geometric_mean_retention
labels = quantizer.predict_scores(estimated_scores)
achieved = sq.information_report(
exact_provider().score(test_observations), labels, n_bins=quantizer.n_bins
).geometric_mean_retention

The reported retention barely moves with the training size. With 15 events per component the bins report 0.9658 and achieve 0.8847. With 300 the two agree to within 0.0035: the bins did not change their behaviour, the score they were given got better.
ScoreQuant measures the information lost by binning. Information lost earlier, when the score was estimated, is invisible to it, which is what the surrogate label means.
5. A check without the exact score
A real analysis has no exact score, but it can test one consequence of the construction. Each ratio to the training mixture averages to one under that mixture, because . ratio_closure_report measures the largest deviation on a sample:
closure_observations = draw_training_mixture(4242, 50_000)
closure = sq.ratios.ratio_closure_report(
estimated.ratio(closure_observations), np.ones(len(closure_observations))
)
The residual falls from 0.0420 at 15 events per component to 0.0032 at 300. A large residual exposes a bad ratio; a small one is necessary but not sufficient, since closure tests the normalization and not the shape (glossary (opens in a new tab)).
Here the gauge does matter. A ratio to the training mixture averages to one under the training mixture and under nothing else, so the sample must be drawn from it: balanced here, not the reference mixture of the data. On the reference mixture even the exact ratio leaves a residual of 0.1800, larger than the worst classifier's.
6. What the result means
A classifier makes the score computable without a likelihood. Its calibrated posteriors, divided by the training proportions, are density ratios in a gauge the score does not see, and ScoreQuant bins that score as well as it bins any other. What it reports, though, is how much of the estimated score survives the binning, not how much of the information in the data. A better classifier closes that gap; the binning cannot, and closure on the training mixture is the check a real analysis has.
The binning itself was the easy part here. With one score coordinate, equal-width or quantile bins of the same estimated score come close to the fitted partition, and at the largest training size equal-width bins edge slightly ahead. The choice of cells matters when several score coordinates must share a few bins, as in the Higgs search and the cell populations, both of which build their scores as described above.