Fit a nondecreasing calibration mapping with the Pool Adjacent Violators algorithm. First sort calibration pairs by probability. Start with one block per binary label and repeatedly merge adjacent blocks whenever the earlier block mean exceeds the later block mean. Assign each point its final block mean.
This minimizes:
i=1∑n(yi−ci)2subject to:
c1≤c2≤⋯≤cnHere, yi is the sorted calibration label and ci is its fitted value. For each new probability, clamp outside the calibration range and linearly interpolate between neighboring fitted points inside the range. Return a list of calibrated probabilities in the original new-probability order.
Input: cal_labels = [0, 0, 1, 1], cal_probs = [0.1, 0.3, 0.7, 0.9], new_probs = [0.5]
Output: [0.5]
Explanation: The fitted values remain [0, 0, 1, 1], and 0.5 lies halfway between probabilities 0.3 and 0.7.
Input: cal_labels = [0, 1, 0, 1], cal_probs = [0.1, 0.4, 0.6, 0.9], new_probs = [0.2, 0.5, 0.8]
Output: [0.166667, 0.5, 0.833333]
Represent each PAV block by its label sum and point count.
After fitting, use binary search or a linear scan to find neighboring calibration probabilities.
Sign in to take notes on this problem
Accepts: array
Accepts: array
Accepts: array
Fit a nondecreasing calibration mapping with the Pool Adjacent Violators algorithm. First sort calibration pairs by probability. Start with one block per binary label and repeatedly merge adjacent blocks whenever the earlier block mean exceeds the later block mean. Assign each point its final block mean.
This minimizes:
i=1∑n(yi−ci)2subject to:
c1≤c2≤⋯≤cnHere, yi is the sorted calibration label and ci is its fitted value. For each new probability, clamp outside the calibration range and linearly interpolate between neighboring fitted points inside the range. Return a list of calibrated probabilities in the original new-probability order.
Input: cal_labels = [0, 0, 1, 1], cal_probs = [0.1, 0.3, 0.7, 0.9], new_probs = [0.5]
Output: [0.5]
Explanation: The fitted values remain [0, 0, 1, 1], and 0.5 lies halfway between probabilities 0.3 and 0.7.
Input: cal_labels = [0, 1, 0, 1], cal_probs = [0.1, 0.4, 0.6, 0.9], new_probs = [0.2, 0.5, 0.8]
Output: [0.166667, 0.5, 0.833333]
Represent each PAV block by its label sum and point count.
After fitting, use binary search or a linear scan to find neighboring calibration probabilities.
Sign in to take notes on this problem
Accepts: array
Accepts: array
Accepts: array