Robustness, label quality, and active data acquisition · Robustness, label quality, and active data acquisition · ROB007 · Algorithm
Confident learning
Estimate label-quality structure using out-of-sample class probabilities, class-specific thresholds, confident counts, calibration, and ranking. It supports targeted review of suspected label issues.
In CodeSplash
A CodeSplash feature runs this entry inside the app, not as a Python and R method. There's no Set up button; open it where the label says.
Do it in CodeSplash Run it on your own data in the app: Predict run page › Label issues tab (classification runs; out-of-fold probabilities, cleanlab's defaults; you review, the app never changes a label by itself).
- Availability
- Runs in CodeSplash (Predict)
- Code example
- Complete calculation
- Who ran it
- CodeSplash's run and the reference's record
- CodeSplash's run
- The reference's example ran here in one language.
- The reference's record
- Python: Ran in the reference's review, on this exact code. R: Reviewed but not run: R wasn't available to the reference's authors.
Purpose
Estimate label-quality structure using out-of-sample class probabilities, class-specific thresholds, confident counts, calibration, and ranking. It supports targeted review of suspected label issues.
Question / hypotheses
Which given labels are inconsistent with the model-supported class structure, and what noise pattern is compatible with the estimates? A flagged record is not automatically mislabeled.
Architecture / computational structure
A cross-validation prediction pipeline produces out-of-sample probabilities. Thresholded assignments form a confident joint; calibrated counts estimate a noisy/latent-label joint distribution. Ranking and pruning or human review use these estimates. The toy example isolates thresholds and candidate flags only.
Assumptions
The paper’s principal guarantees use a class-conditional label-noise model and conditions on prediction quality. Out-of-sample probabilities and stable class ordering are essential. Model misspecification, annotator ambiguity, and open-set examples can look like label errors.
Formula / computational definition
Parameters and notation
Fitted quantities: predictive model and joint/noise estimates. Design choices: folds respecting groups/time, probability estimator, class mapping, confidence thresholds, ranking/pruning rule, review budget, and calibration convention. The labels remain uncertain; predicted class is not observed ground truth.
Fitting, fine-tuning, and adaptation
Generate probabilities without training on each scored case. Recompute after material model, domain, or labeling-policy changes. Prefer a documented relabeling process to irreversible automated deletion. Keep both original and adjudicated labels with reasons; train downstream models only after fixing the evaluation protocol.
How to use and calibrate
Audit cross-validation leakage, review a stratified sample of flags and unflagged records, and measure human-confirmed precision/recall when possible. Separate training-set cleaning from benchmark adjudication. Report changed labels and downstream sensitivity rather than only a cleaner-looking score.
Example application
Prioritize review of a multiclass text dataset with inconsistent category guidelines; resolve ambiguous definitions before attributing every disagreement to annotator error.
Interpretation / pitfalls
Watch out
In-sample probabilities are overconfident for memorizing models. Rare valid examples can be flagged. Test-set editing guided by the evaluated model creates a different benchmark and must be transparent. The component below is not the full calibrated confident-learning estimator.
Python and R code examples
Scope: Calculate class thresholds and a transparent candidate-review mask, not the full confident joint/pruning algorithm. Python: NumPy; R: base R. Full route: cleanlab documentation.
Validation: Python executed successfully on the supplied fixture; R reviewed but not executed.
Python and R
The reference's own programs, shown as written. A component demo shows one central piece of the method; it doesn't train a full model.
Complete calculation — Calculate class thresholds and a transparent candidate-review mask, not the full confident joint/pruning algorithm. Python: NumPy; R: base R. Full route: cleanlab documentation. · needs numpy
import numpy as np
y=np.array([0,0,1,1]); P=np.array([[.9,.1],[.2,.8],[.1,.9],[.3,.7]])
t=np.array([P[y==j,j].mean() for j in range(2)])
pred=P.argmax(1); flag=(pred!=y)&(P[np.arange(len(y)),pred]>=t[pred])
print("thresholds",t,"candidate_indices",np.flatnonzero(flag))
assert np.array_equal(np.flatnonzero(flag),[1])
Complete calculation — Calculate class thresholds and a transparent candidate-review mask, not the full confident joint/pruning algorithm. Python: NumPy; R: base R. Full route: cleanlab documentation.
y <- c(1,1,2,2); P <- rbind(c(.9,.1),c(.2,.8),c(.1,.9),c(.3,.7))
t <- vapply(1:2,function(j) mean(P[y==j,j]),numeric(1))
pred <- max.col(P,ties.method="first")
flag <- pred!=y & P[cbind(seq_along(y),pred)]>=t[pred]
print(list(thresholds=t,candidate_indices=which(flag)))
stopifnot(identical(which(flag),2L))
Sources
- Source 1arxiv.org
- Source 2docs.cleanlab.ai
From the CodeSplash reference, entry ROB007.