Systems and records
Exception oversampling dataset weighting: estimate what the flag missed
By SourceX Editorial · Updated
9 sections
Short answer
Exception oversampling dataset weighting works only when the base rate comes from a probability sample, not from the count of records a system flagged. Flags miss exceptions and mislabel ordinary cases, so audit a random draw of flagged and unflagged records, estimate prevalence with an interval, and keep that prevalence ledger separate from the training mix you choose. When the audit finds nothing, report an upper bound instead of a zero.
Checklist
Exception oversampling
Key takeaways
- A flag count measures the flag, not the exception: it includes ordinary records caught by mistake and leaves out exceptions the rule never caught.
- A two-phase miss audit, reviewing random draws of flagged and unflagged records, turns a flag into a prevalence estimate with an interval.
- In this article's illustrative worksheet, about 23 percent of estimated exceptions sit in the unflagged pool that flag-based oversampling never touches.
- Keep two ledgers: prevalence is estimated and carries uncertainty, while training emphasis is chosen and carries a reason.
- When an audit finds nothing, report an upper bound of roughly 3 divided by the number reviewed, never a zero.
Where does an exception's real frequency come from when you oversample it?
From a probability sample of the whole frame whose labels a reviewer has checked, not from the number of records a system flagged and not from the mix you train on. Three numbers get confused in exception datasets: the share of records carrying an exception flag, the share of exceptions in the training set, and the share of records that really are exceptions. Only the third describes the business, and it is the only one a model's rates should be weighted back to.
The SourceX guide to oversampling rare cases with frequency weights covers the bookkeeping: inclusion probabilities, design weights and frame counts that let anyone reweight an enriched sample. That bookkeeping assumes you know which stratum each record belongs to. In most business archives you do not. The exception stratum is defined by a status field, a rules engine or a keyword search, and design weights computed from it reproduce the flag's view of the archive, errors included.
The decision here comes before any weighting: which number to use as the exception rate when you choose a training mix or report a model's precision, and what evidence a dataset must carry before anyone should trust that number.
Why is a flag count not a prevalence estimate?
Because flags fail in two directions at once. Some flagged records are ordinary cases caught by a broad rule, and some real exceptions were never flagged, because the rule did not anticipate them or because someone resolved them without changing a status. The flag count includes the first error and omits the second, and nothing in the count says which one dominates.
Even carefully built datasets carry both errors. Northcutt, Athalye and Mueller estimated label errors averaging at least 3.3 percent across the test sets of 10 widely used benchmark datasets. When their algorithm flagged candidate errors, human reviewers confirmed 51 percent of the candidates on average, so an automated flag was right about half the time. A business exception flag, written once by an analyst and never re-validated, has no stronger claim to accuracy.
Oversampling from the flagged pool inherits both errors. It overweights whatever the rule over-catches and leaves the missed exceptions out of the dataset entirely, and those are often the unusual cases a model most needs to see.
The miss audit: a two-phase design for exception prevalence
Run the flag over the whole frame, then send a random subsample of flagged and unflagged records to reviewers who label exceptions from the source record. Survey statisticians call this two-phase sampling, or double sampling, and have long used it as a cost-effective design: a cheap measurement on many units first, an expensive one on a subsample second. The flag is the cheap phase; the reviewer's label is the expensive one.
Estimate each stratum on its own and add the results. Multiply the flagged count by the confirmed share among reviewed flagged records, multiply the unflagged count by the share of exceptions found among reviewed unflagged records, and divide the sum by the frame. Each audited record carries the inclusion probability of its stratum, so the estimate is itself a weighted one, and most of its uncertainty comes from the unflagged stratum, where exceptions are rare.
Write the review rule before anyone reviews. Reviewers need a definition of an exception that can be applied to the source record with the flag hidden, boundary examples, and a second reviewer on a share of records so agreement can be measured. If reviewers cannot agree, the prevalence estimate inherits the disagreement, and the honest output is a range under each definition.
Sampling worksheet: from flag count to prevalence with an interval
The worksheet runs the miss audit on an invented accounts payable archive. Every number is illustrative and describes no real dataset; the formulas are the part to reuse.
In this example the flag reports 3.0 percent and the audit estimates 2.5 percent, but the smaller gap hides two larger errors. The flag over-catches, since only 65 percent of flagged records were confirmed, and it misses: about 1,160 of the estimated exceptions sit in records it never flagged. That second figure is uncertain. Nine exceptions in 1,500 reviewed records gives a Wilson 95 percent interval of roughly 0.3 to 1.1 percent, so the flag missed somewhere between about 600 and 2,200 exceptions.
Method note: per-stratum intervals are Wilson intervals, and the interval for the combined rate is a normal approximation with a finite-population correction across the two strata. Nothing in the worksheet was measured on real records, and SourceX has not published miss-audit results for any dataset; this is the method only.
Record each line with its date, the flag version and the reviewer guideline in force:
| Worksheet line | How to compute it | Illustrative value | Record alongside it |
|---|---|---|---|
| Frame | All records in scope on the extract date | 200,000 invoices | Systems, period and extract query |
| Flagged stratum | Records carrying the exception flag | 6,000 (3.0% of the frame) | Flag rule and its version |
| Flagged audit | Random draw reviewed against the written definition | 260 of 400 confirmed (65%) | Reviewer guideline and agreement rate |
| Unflagged audit | Random draw from records without the flag | 9 of 1,500 found (0.6%) | Seed and the stratum's inclusion probability |
| Estimated exceptions | 6,000 x 0.65 + 194,000 x 0.006 | 3,900 + 1,164 = 5,064 | Per-stratum estimates, not only the total |
| Prevalence with interval | Estimated exceptions divided by the frame | 2.5% (about 2.1% to 2.9%) | Interval method used |
| Share the flag missed | Unflagged estimate divided by the total | About 23% | Its own interval, which is wide |
| Training mix | Chosen, not estimated | 50% exceptions | The reason, and weights back to 2.5% |
Training emphasis and real-world prevalence belong in separate ledgers
Keep the training mix and the prevalence estimate in two ledgers that never overwrite each other. The prevalence ledger holds an estimate, its interval, the audit that produced it and its date. The emphasis ledger holds a choice, the reason for it and the weights that map any rate measured on the training mix back to the estimate. In the worksheet, a 50 percent exception mix means any rate measured on that mix is reweighted by multiplying exception records by 2.5/50 and ordinary records by 97.5/50.
Evaluation practice shows why the split matters. Anthropic's guidance on agent evals separates capability evals, which should start at a low pass rate, from regression evals, which should sit near 100 percent. Each set is composed for a purpose, and neither pass rate estimates how often a task succeeds in production. OpenAI's GDPval publishes its composition rule instead of implying prevalence: 44 occupations drawn from nine sectors that each contribute more than 5 percent of U.S. GDP, chosen with wage and employment data, and 1,320 specialist tasks in the full set. A stated selection rule tells readers how to read the shares; an exception dataset needs one too.
Merging the ledgers is how frequency gets invented. A dataset card that reports 50 percent exceptions with no second ledger will be read downstream as a fact about the business, and a model trained on that mix will predict exceptions far more often than they occur unless its outputs are corrected.
What can an oversampled exception set claim, and what can it not?
Its claims are bounded by the audit behind it, not by its size. The coverage limitations table pairs each claim a team might want to make with the evidence that supports it and the gap that remains.
Precision is the claim most easily overstated. An empirical study of sampling methods in PLOS ONE found that the measured benefit of resampling imbalanced data was more pronounced under AUROC than under AUPRC, which the authors note is known to be more informative for imbalanced classification. Report precision on test data weighted back to the prevalence ledger, or on a natural-frequency holdout, and say which one you used.
Use the table as the dataset's limitations statement:
| Claim | Supported when | Not supported because | Evidence that would close the gap |
|---|---|---|---|
| Overall exception rate | A two-phase audit covers flagged and unflagged records | A flag count alone mixes false alarms and misses | Audit with an interval and a dated flag version |
| Rate by exception type | Each type has enough audited cases for its own interval | Rare types may have only a handful of audited cases | A larger unflagged draw or type-specific strata |
| Exception types the flag never catches | The unflagged audit found and described them | None found in a sample is not none in the frame | An upper bound, and a bigger draw if it matters |
| Share of exceptions in the dataset | Stated as a choice in the emphasis ledger | It reflects the mix chosen, not the business | The prevalence ledger shown beside it |
| Model precision in production | Measured on data weighted back to prevalence | Precision on an enriched set reflects the enriched mix | A natural-frequency holdout |
| Periods, channels or units outside the frame | Never, from this dataset | Weights cannot recover records the frame lacks | A new frame that includes them |
How to report small counts and audits that find nothing
Use an interval built for small counts, and never report zero as a rate. Brown, Cai and DasGupta showed that the textbook Wald interval for a binomial proportion has erratic coverage, and they recommended the Wilson interval or the equal-tailed Jeffreys interval for small samples. Exception audits are that case exactly: a handful of events in a large draw.
When the unflagged audit finds nothing, the result is a bound, not a zero. Hanley and Lippman-Hand's 1983 paper in JAMA examined why a result with zero events is especially tricky to interpret, and why readers treat it as different in kind from a single event. A workable approximation follows from the arithmetic: if none of n randomly drawn records is an exception, the 95 percent upper bound on the rate is about 3 divided by n, because (1 - 3/n) raised to the power n is close to 0.05. Zero in 1,500 unflagged invoices still allows a miss rate of about 0.2 percent, or roughly 390 missed exceptions among 194,000 records.
Size the unflagged draw from the bound you need. To show that the flag misses fewer than 1 record in 1,000, with no exceptions found, review about 3,000 unflagged records; for fewer than 1 in 10,000, about 30,000. When that costs too much, say so and publish the bound you could afford.
Could a large exception count make the audit unnecessary?
No. A large count can hide three problems that more records do not fix. Repeated cases inflate it when one incident is logged as many records, so deduplicate to the case before auditing. Selection bias shapes it when the flag catches only the kinds of exception its author anticipated. Unobserved failures sit outside it when exceptions were settled by phone, email or a workaround that never changed a status.
Volume makes each of these harder to see, because a confident-looking count invites people to skip the audit. Fifty thousand flagged records are fifty thousand views through the same rule. The miss audit is the only step that looks at records the rule did not select, and its cost grows with the precision you want, not with the size of the archive.
The other alternative is that the flag is simply accurate. That can be true, and the audit is how you show it: a high confirmed share in the flagged stratum and a tight upper bound in the unflagged one are evidence a buyer can accept, where an assertion of accuracy is not.
Writing the miss audit into a data request
Ask a supplier for the inputs, not only the enriched sample: frame counts, the flag definition and its version history, the reviewer guideline, the random audit draws from both strata with their labels, and both ledgers. If the supplier has no audit, ask for frame counts and flag counts so you can design one, and budget for the review time.
Because SourceX sources each dataset from U.S. businesses only after a buyer asks, with no inventory to pick from, the request form carries the specification: scope, volume, language, format, timing and licensing needs. A request for exception data can name the flag that defines the stratum, ask for a miss audit of unflagged records, and state the acceptance test, for example a prevalence estimate with an interval plus an upper bound for the unflagged stratum. Whether a particular business's records can meet that test is assessed request by request.
Frequently asked questions
Can I use the share of flagged records as the exception rate?
Only after an audit shows the flag is accurate in both directions. A flag count includes ordinary records the rule caught by mistake and excludes exceptions it never caught. Review a random draw of flagged and unflagged records, then estimate the rate from both strata.
How many unflagged records should a miss audit review?
Size it from the bound you need. If no exceptions turn up among n random unflagged records, the 95 percent upper bound on the miss rate is about 3/n, so roughly 3,000 records bound it near 0.1 percent. If exceptions are found, use a Wilson or Jeffreys interval for the estimate.
Does oversampling exceptions change a model's measured precision?
Yes. Precision depends on how common the positive class is in the test data, so precision measured on an enriched set reflects the enriched mix. Measure it on a natural-frequency holdout, or on test data weighted back to the audited prevalence.
What if reviewers disagree about what counts as an exception?
Measure agreement on a double-reviewed share of the audit and tighten the definition before estimating. If disagreement persists, report a prevalence range under each definition rather than one number, and ship the definitions with the dataset.
Should a training mix match real-world exception prevalence?
Not necessarily. A richer mix can give a model enough rare cases to learn from. What matters is that the mix is recorded as a choice, with weights back to the audited prevalence, so nobody mistakes it for a fact about the business.
Sources
- Northcutt, Athalye and Mueller estimated an average of at least 3.3 percent label errors across the test sets of 10 widely used datasets, and human reviewers confirmed 51 percent of algorithmically flagged candidates on average. Source
- Two-phase sampling, also called double sampling, has traditionally been used in sample surveys as a cost-effective design. Source
- Brown, Cai and DasGupta (Statistical Science, 2001) found the Wald interval's coverage erratic and recommended the Wilson or equal-tailed Jeffreys interval for small samples. Source
- Hanley and Lippman-Hand's 1983 JAMA paper addresses how to interpret results with zero numerators. Source
- A PLOS ONE study of sampling methods for imbalanced classification found the effect of sampling more pronounced under AUROC than AUPRC, noting AUPRC is known to be more informative for imbalanced classification. Source
- Anthropic's guide to agent evals distinguishes capability evals, which start at a low pass rate, from regression evals, which should sit near 100 percent. Source
- OpenAI's GDPval covers 44 occupations across nine sectors that each contribute more than 5 percent of U.S. GDP, with 1,320 specialized tasks in the full set. Source
- The GDPval paper selected sectors by contribution to U.S. GDP and occupations within them using wage and employment data from the U.S. Bureau of Labor Statistics. Source
Tell us what data you need
Share scope, volume, format, timing and licensing needs. Datasets are sourced on request.