# Why did a cutoff near 78% score worse when we actually used it?

A system estimates a 79% chance that a customer will return an order. Should the system flag the order? A rule that flags anything at or above 75% says yes. A cutoff of 80% says no. One probability produces two different decisions.

In a test with eight invented cases, we asked a tool to choose a cutoff that made good decisions. It recommended one near 78% and reported a score of about 0.58. Applying that recommendation to the same saved probabilities gave us 0.50. We traced the difference to how the tool tried the cutoffs.

The tool, scikit-learn’s `TunedThresholdClassifierCV`, scores two groups of cases separately and averages the scores. Such groups are called validation folds. In the first run we asked for 100 cutoffs. That setting lets each group try its own values and estimate the scores in between. In the second run we gave both groups the same list of 100 values to try. The cases and their probabilities stayed fixed.

## What the score counts

Each group contained four cases, two where the correct answer was yes and two where it was no. A predicted probability at or above the cutoff counted as yes. We took the fraction of actual yes cases correctly marked yes and the fraction of actual no cases correctly marked no, then averaged them. The result, called [balanced accuracy](https://scikit-learn.org/1.9/modules/generated/sklearn.metrics.balanced_accuracy_score.html), gives the two kinds of case equal weight.

## The difference between asking for 100 cutoffs and specifying the 100 values

**The recommended cutoff, the score reported for it, and its score on the saved cases**

| How cutoffs were supplied | Chosen cutoff | Score reported by the tuner | Score after applying the cutoff |
| --- | ---: | ---: | ---: |
| Count of 100 | 0.779830 | 0.584337 | 0.500 |
| Same 100 shared cutoffs given as a list | 0.851799 | 0.625 | 0.625 |

In the first row (‘Count of 100’), each group tested its own set of cutoffs. The recommended cutoff is shown as 0.779830 and its estimated balanced accuracy as 0.584337. When we applied the chosen cutoff to the saved probabilities, the decisions earned group scores of 0.00 and 1.00. Their average was 0.500.

In the second row we gave both groups the same list. Fourteen cutoffs tied for the best score. At the first of them, shown as 0.851799, the groups earned 0.50 and 0.75. Their average, 0.625, matched the report. We obtained these results in scikit-learn 1.7.2 and 1.9.1. [Cutoff settings](https://scikit-learn.org/1.9/modules/generated/sklearn.model_selection.TunedThresholdClassifierCV.html)

With a separate set of cutoffs for each group, a cutoff on the common comparison list can fall between two values a particular group actually tested. The tool estimates the score there from the neighboring measurements, then averages the group estimates to choose a cutoff. It doesn’t go back and apply that candidate to each saved probability when forming the estimate. With an explicit common list, both groups test the same candidates directly. [How each group is scored](https://github.com/scikit-learn/scikit-learn/blob/866c0f51e7560ef0303cbcc5f159df5382ea9e3f/sklearn/metrics/_scorer.py#L1145-L1168) · [How the tool selects a cutoff](https://github.com/scikit-learn/scikit-learn/blob/866c0f51e7560ef0303cbcc5f159df5382ea9e3f/sklearn/model_selection/_classification_threshold.py#L789-L819)

## Keep enough to try the rule again

Keep each case’s probability at its original precision, its group and the correct answer. Save the cutoffs tested, the full value of the chosen cutoff and the rule for a probability exactly on the boundary. Apply the chosen cutoff within each group. Reporting those scores and how you combined them lets someone check the calculation on the same cases. Judging how well the cutoff will work on new cases takes a separate test.

## Related research

- [A reading-test grader reported a best score of 50. Its own rules gave 100.](https://sapien1.com/research/squad-v2-threshold-consistency)
- [Why a test ranked both models first and picked whichever was listed first](https://sapien1.com/research/audit-cross-validation-auroc)

[Interpreting test scores](https://sapien1.com/research#scores)
