Sorting, Probability and Calibration: AUC
Four samples were used to distinguish between sorting capacity, probability errors, volume accuracy and decision-making costs, explaining the boundary between calibration and cluster assessment.
Learning objectives and first steps4 objectives 2 first repairs
Try to do it after reading
- Handcount with parallel scores AUC
- Comparison of Brier, logarithm loss and reliability graph
- Explains that the proportion of totals cannot be a substitute for group probability accuracy
- Select evaluation, calibration and thresholds in stand-alone data protocols
Suggested first
- Conditional probabilities and classification of losses
- Training validation test division
A score takes a couple of jobs
In the sorting of searches, fractions are often used to queue candidates; In the risk estimate of a fixed time window, scores may also enter into the calculation of the amount of the loss and the strategic value. The correct sequencing requires only that high-risk samples be in front of low-risk samples, while probability calculations require that the values themselves match the frequency of events. If both uses share a model, they will need to be examined separately and one AUC cannot replace all acceptances.
This chapter uses four composite two-synthesis samples. First, the test set of probabilities, cross entropy and independent tests. The objective is to calculate the sorting and probability indicators by hand, to identify the discrepancy between aggregate errors and to design a data division for probabilities calibration. The projected vector here is a teaching comparison, not a calibration device trained from four test data, and cannot be relied upon to claim that a particular method leads to an increase on the line.
The sequence is exactly correct, and the probability is still much worse
The label is [0,0,1,1]. The projection is [0.01,0.02,0.03,0.04] and the projection B is [0.00,02, 0.8, 0.9]. Both groups rank the positive cases before the negative ones, AUC, both, but it is highly unlikely that the two true positives will be judged. AUC is defined as a positive and negative case at random, with a positive score of 1, 0 and a 0.5, and then an average of all pairs.
(b) Strict single-line changes in the order of reservations, so that AUC is retained when the value is added to the change; However, it changes the probabilities, logarithmic losses and categories below thresholds. In the absence of a positive or negative case, AUC is not defined and should be reported as non-calculable and cannot default on zero. For very few active tasks, the PR curves, fixed recall accuracy and uncertainty should also be checked and the corresponding population and time windows retained.Official indicator files These definitions and boundaries can be verified.
Check the values themselves with probabilities loss
The Brier score is the square average of the difference between the predicted probability and the label. Brier for A is 0.46575 and B is 0.025, which is better on this sample. Logarithm losses also more severely punish self-confidence and the probability of error. Both are tools for measuring probabilities under a clear label distribution, are not two versions of the same unit and should not be interpreted as operating gains at random.
The reliability map compares the average forecast and actual incident rates in the sample compartments, which are similar to those projected. (a) All landed in the low probability area, with an average value of 0.025, but a 0.5 incident rate was observed; B is divided by low and high boxes corresponding to (0.15,0) and (0.85,1). Only four samples are available and cannot be considered stable overall calibration curves; The number of boxes, the width or the frequency, the weight and the confidence interval all affect the interpretation. ECE may also change under different sub-boxes and the calculator should be retained.
The amount of precision will cover up local errors
A composite ratio is clearly defined here as “the sum of the predicted events divided by the sum of the observed events”. It is called PCOC in part of the engineering context, and the specific name and direction are not uniform criteria, and a formula must be written in the report. The margin value for A is 0.05 and B is 1. However, two other labels [0,1] were taken, and the margin [0.9,0.1] was projected to remain at 1 and in exactly the opposite order, with Brier reaching 0.81. This suggests that total errors can be offset against each other.
If the amount of the loss is anticipated, the denominator should be the sum of the actual amount, not the number of events; The principal-weighted rate of loss has its own denominator and cannot be omitted in the same table. Before, during, credit limit Paragraphs, activity and calibration for different periods should also be examined separately. (b) Groups with zero observations, the margin of which cannot be calculated; An artificial addition of a very small amount may receive a large false signal, preferably accompanied by an absolute error, sample size and maturity.
Calibration and thresholds require separate protocols
The calibrator can learn from the probability map by fraction, such as a parameterized sigmoid or a single-line isotonic. The calibration model should be drawn up on the prediction of samples not used for training in the base model and the final test set should be retained; Time series data are also subject to deployment times.Official Calibration Document The relationship between probabilistic prediction and calibration devices was explained. Single-map usually keeps sorting, but the number constants are introduced in parallel; Group calibration may also change the order of groups across groups, and cannot be promised AUC forever.
Classification thresholds address the choice of action, relying on misreporting, underreporting and resource costs. If model probabilities are credible and the cost of misreporting is 1 and the cost of underreporting is 4, the threshold for minimizing the expected cost of both conditions is 1/(1+4) = 0.2; This relies on the simplified cost model. There may also be capacity constraints, multiple actions and long-term feedback.Threshold Document The probability estimate is distinguished from the action layer and the same test benefit cannot be reported at the test set repeated-text threshold.
Implemented standard Python recovery
The following Python3 standard library has been implemented at CPU, no random numbers and no calibration framework has been called.
import math
def auc(y,p): pos = [s for t,s in zip(y,p) if t==1] neg = [s for t,s in zip(y,p) if t==0] if not pos or not neg: raise ValueError('AUC requires both classes') return sum((a>b)+0.5*(a==b) for a in pos for b in neg)/(len(pos)*len(neg))
def brier(y,p): return sum((a-b)**2 for a,b in zip(y,p))/len(y)
y = [0,0,1,1]for p in [[.01,.02,.03,.04],[.1,.2,.8,.9]]: print(auc(y,p),round(brier(y,p),6),sum(p)/sum(y))# 1.0 0.46575 0.05# 1.0 0.025 1.0assert auc([0,1],[.5,.5]) == .5assert math.isclose(brier([0,1],[.9,.1]), .81)print(1/(1+4)) # 合成代价模型的阈值 0.2Self-measure and answer
Multiply the whole number by ten, AUC must be down?
(b) Strictly sequenced and unincorporated value cutbacks or parallel columns; If the original fraction is a probability, the multiplier may exceed the defined domain by ten times and cannot be used as a probability.
AUC is 1 and why is Brier bad?
It places higher priority on the list, but the absolute probability remains low. AUC only looks in pair order, and Brier directly compares probabilities with labels.
The total forecast is equal to the total observation. Can we skip the group calibration?
Can't. Overvaluation and underestimation offsets; Time to check, customer segment Group with key groups, such as business actions, and demonstrate sample volumes.
Can four samples' reliability maps prove that the probabilities on the line have been calibrated?
Can't. The sample was too small and the compartments and random fluctuations were evident; There is also a need for independent and mature data that represent the distribution of the goals.
Report the test set Brier using the test set to calibrate the map. What's the problem?
The test set is involved in the selection of parameters, creating optimistic deviations. Training, calibration and final evaluation should be separated or controlled cross-fitting should be introduced.
Can the threshold of 0.2 be used for any cost structure?
Can't. It is derived from the misreporting of the cost of this paper, the underreporting of the cost, and the credible probabilities of the two actions set; Changes in costs, constraints and feedback will also change the rules of decision-making.
Read it next counterfactual LTV and offer Decision, depends on how the probability range and the sequence of actions together influence the strategy.
Interactive Counting / Fixed Data
How are the chances and decisions changed?
Four composite samples: labels [0,0,1,1], initial probability [01, 0.2, 0.8, 0.9]. Temperatures are used in logit, and no parameters are drawn on these four samples.
- Twinning AUC
- 1.000
- Brier. The lower the better
- 0.0250
- Log loss The lower the better
- 0.1643
- Correct number under current threshold
- 4 / 4
The normal temperature changes to a strict sequence, so this example AUC remains unchanged. (b) Probability errors change; The threshold changes decision-making only. Four samples do not demonstrate overall calibration quality.
Displays the initial results at the moment. Enables JavaScript to operate the case.
Sources and reconciliations
Definitions, methods and interfaces are available.
- scikit-learn Metrics and scoring
- scikit-learn Probability calibration
- scikit-learn Tuning the decision threshold
Figures and calculations are reorganized according to this chapter. Mathematical measurements, framework operations and real business effects are described separately in the body of the text.