@@ -29,7 +29,7 @@ def _noop_log(_msg: str) -> None:
2929def _cp_lower (k : int , n : int , alpha : float ) -> float :
3030 """Exact (Clopper-Pearson) lower confidence bound on a binomial rate.
3131
32- Used to gate deployment on an honest bound rather than a point estimate, so
32+ Used to gate deployment on a held-out lower bound rather than a point estimate, so
3333 a small or lucky accepted set cannot 'scrape' the target agreement.
3434 """
3535 if n == 0 or k == 0 :
@@ -141,17 +141,17 @@ def _accept_scores(acceptor, probs):
141141
142142
143143def _calibrate_threshold (scores , preds , y_teacher , target_ta , alpha = 0.1 , min_accept = 10 ):
144- """Choose the accept threshold honestly , then check it generalises.
144+ """Choose the accept threshold on a held-out lower bound , then check it generalises.
145145
146146 Earlier iterations sat at two extremes. The original gate selected the
147147 threshold and reported its agreement on the *same* calibration set (in-sample
148148 point estimate), so a threshold could clear target by luck and break the
149149 contract on real traffic. The next version held out 50% for a Clopper-Pearson
150- verification, which is provably honest but so data-hungry that on a few-hundred
150+ verification, which is provably valid (distribution-free) but so data-hungry that on a few-hundred
151151 calibration rows it certified NOTHING at strict targets (banking77 0% @0.98)
152152 even though the confidence ranking clearly supported partial coverage.
153153
154- This is the hybrid that keeps honesty while recovering that coverage:
154+ This is the hybrid that keeps the held-out guarantee while recovering that coverage:
155155
156156 1. Select on a 70% slice: among thresholds whose Clopper-Pearson LOWER bound
157157 on accepted agreement clears target, take the highest-coverage one
@@ -165,7 +165,7 @@ def _calibrate_threshold(scores, preds, y_teacher, target_ta, alpha=0.1, min_acc
165165 that survives the held-out check, so coverage is monotonic in target.
166166
167167 On very little data (n < 40) there is nothing to hold out, so it falls back to
168- a single-set Clopper-Pearson lower-bound gate (still honest , just not held-out)
168+ a single-set Clopper-Pearson lower-bound gate (still a valid lower bound , just not held-out)
169169 and flags it. Validated across seeds and datasets at 0.90-0.98 with zero
170170 held-out contract violations.
171171 """
@@ -219,7 +219,7 @@ def _calibrate_threshold(scores, preds, y_teacher, target_ta, alpha=0.1, min_acc
219219 if (k_v / n_v ) < target_ta : # held-out generalisation check
220220 continue
221221 # Report the CP lower bound on the full accepted set (all calibration rows
222- # at this threshold) as the honest deployable bound.
222+ # at this threshold) as the deployable lower bound.
223223 acc_all = scores >= t
224224 n_all = int (acc_all .sum ())
225225 k_all = int ((preds [acc_all ] == y_teacher [acc_all ]).sum ())
@@ -447,7 +447,7 @@ def fit_frontier(X, y_teacher, targets, max_fit_labels=8000, min_coverage=0.05,
447447
448448 `alpha` is the confidence level for the deployment lower bound: a candidate
449449 is only certified if the lower bound on its held-out teacher agreement clears
450- the target, so reported coverage is honest rather than in-sample-optimistic .
450+ the target, so reported coverage reflects a held-out lower bound rather than an in-sample point estimate .
451451 """
452452 log = log or _noop_log
453453 log (f"fit_frontier: X={ X .shape } targets={ sorted (set (float (t ) for t in targets ))} "
0 commit comments