Data doping creates test observations by copying real records and deliberately changing selected values. The aim is to simulate outliers with known modifications, then check whether a detector scores them above unmodified records. Unlike generating entirely new rows, doping preserves much of each record’s original context. Its usefulness depends on whether the changes resemble the anomalies worth finding. section 8.5.1 section 11.3
Changing a typical value into an unusual combination
Copy a tabular dataset and select one cell per row at random. Replace a value above its feature’s median with a sampled value below the median, or vice versa. The replacement can still be an ordinary value on its own, while becoming unusual alongside the row’s other features. Fit detectors on real data and compare their scores for real and doped rows: higher doped scores indicate sensitivity to this particular kind of disruption, not to every possible outlier. section 8.5.1
Figure 8.10 Scores for real versus doped records when tested on IF, LOF, and ECOD. For this form of doping, LOF performs very well and IF reasonably well. As no extreme values were added in this example, ECOD makes no distinction between the real and doped data.
The score comparison shows why the modification matters: LOF separates these doped records well, IF does so reasonably well, and ECOD does not distinguish them when no extreme values are introduced. section 8.5.1
Design several controlled tests rather than treating one doping rule as a universal benchmark:
- Vary how many features change, how far values move, and whether replacements may exceed observed numeric ranges or categorical values. section 11.3
- Use a consistent numeric shift when a known change magnitude is useful; create test sets at different difficulty levels. section 11.3
- Include relevant patterns such as extreme values, moderate changes across multiple features, and rare combinations; exclude patterns outside the detection goal. section 11.3
Interpret results against the chosen modifications. A changed cell may disturb several feature associations, so its effect is not fully specified by the number or size of edits. Inspect flagged records as well as scores: visually ordinary doped rows need not all be flagged, while conspicuously unusual combinations should be. Doped rows can also be mixed in small numbers with current data to test detection there, provided they do not substantially change the training distribution. Ground-truth labels make metrics such as AUROC possible, but hand-labeling and project-specific doping remain more relevant than general detector rankings. Avoid evaluating a system solely with the same synthetic-data method it uses to identify outliers. section 8.5.1 section 8.8 section 11.3 section 11.6
