Skip to content
ML Academy

Classical ML, validation, metrics, interpretation, debugging · insight-0195

Set the contamination parameter from review capacity and a labelled sample, not as a guess of the anomaly rate

Evidence type
documented fact
Difficulty
medium
Roles
Data scientist, ML engineer
Industries
manufacturing, logistics

Summary: situation, action, reason, boundary

  1. Situation

    You configure IsolationForest or Local Outlier Factor and must choose contamination.

  2. Action

    Treat contamination as a threshold decision: rank by score, label a stratified sample across score bands, and pick the cut-off from precision, recall and daily review capacity.

  3. Reason

    The parameter only places the threshold on the raw anomaly scores; the scores themselves carry no labels, so usefulness must be measured with some labelled data.

  4. Boundary

    Unsupervised outlier and novelty detection in scikit-learn and similar tools.

Symptom or risk

Contamination directly sets how many points are flagged; a guessed value creates a fixed alert quota unrelated to real anomalies.

Exceptions

When a regulator or process fixes the review rate, contamination can simply encode that quota.

Trade-offs

Labelling a sample costs analyst time but is the only way to know precision.

Pitfalls

Fitting an outlier detector on data that contains the anomalies you want to find when the method assumes clean training data (novelty detection).

Lessons and concepts

Claims and their sources