Cost threshold and abstention
Quick answer
Threshold selection converts probabilities into actions. Choose an operating point using validation costs and constraints, and allow abstention when a separate review action is available. Static examples tested locally with Python 3.13.5, scikit-learn 1.8.0 SciPy 1.17.0 and NumPy 2.3.5 where imported. ByteMind package execution is unverified.
Compare costs at three probabilities
for p in [.05,.2,.9]: costs={"negative":8*p,"positive":2*(1-p),"review":1} print(min(costs,key=costs.get))Observed local output:
negativereviewpositiveThis assumes perfect review at a fixed cost; a real review policy must model residual errors.
How it works
With calibrated p and constant false-positive cost C_FP and false-negative cost C_FN (correct actions cost zero), expected cost of predicting 1 is C_FP*(1-p), and predicting 0 is C_FN*p. Predict 1 when p >= C_FP/(C_FP+C_FN), assuming positive total cost and no other constraints. Empirical validation threshold search is useful when scores are imperfect or workload limits apply. Compare candidate costs, specify tie-breaking and freeze the threshold before opening test truth. Abstention is a third action with its own cost: choose the minimum of expected positive, negative and review costs if review is assumed perfect and available. In practice review may fail, cost varies and capacity is limited. Report coverage (fraction automatically decided), selective error on covered rows and total cost including reviews; zero coverage makes selective error undefined. Bootstrap paired test costs for independent rows or use suitable group/block resampling. Under shift the calibrated-probability decision formula may no longer be valid.
Threshold cost on validation
y=[0,0,0,1,1];p=[.1,.3,.6,.4,.8]for t in [.3,.5,.7]: cost=sum(2*(a==0 and b>=t)+8*(a==1 and b<t) for a,b in zip(y,p)) print(t,cost)Observed local output:
0.3 40.5 100.7 8Select .3 using validation only, then freeze it for final evaluation.
Common mistakes
Do not tune threshold or review band on test data. Do not count abstentions as correct or discard their cost. Do not assume calibrated probabilities remain calibrated after deployment drift.
Practice and next steps
With FP=2, FN=8 and review cost=1, compute the best action at probabilities .05, .2 and .9; discuss capacity limits. Complete the knowledge check and staged exercise. Next: Explainable AI and interpretation.
Check Your Understanding
Solidify your learning with the interactive assessment directly below this lesson.
Concept Quiz & Questions
Cost threshold and abstention — knowledge check
Apply cost threshold and abstention to new scenarios.
Cost threshold for FP=2 and FN=8?
What dataset selects operating point?
Review costs should be?
Zero automatic coverage implies selective error?
What may invalidate cost formula?