How do you choose an appropriate threshold or contamination rate for an outlier detector?

Quick Overview

Asks how to set the score cutoff or contamination rate for an outlier detector. Tests use of prior anomaly rates, labeled validation data, error costs and review capacity, and how to validate and maintain the threshold as the data drifts.

How do you choose an appropriate threshold or contamination rate for an outlier detector?

Role: Data Scientist

Category: Statistics & Math

Difficulty: medium

Interview Round: Other

How do you choose an appropriate threshold or contamination rate for an outlier detector? ```hint Separate the score from the cut Most detectors produce a continuous score, and the model alone cannot say where normal ends. Ask what information from outside the model could decide where to cut it. ``` ```hint Check what the parameter changes In scikit-learn, look at what `contamination` changes in a fitted `IsolationForest` and what it leaves untouched. ``` ### What a Strong Answer Covers - Treating the detector's output as a score and the threshold as a separate decision - Ways to set the cutoff with labels, with error costs, with a review budget, and with no labels at all - What a contamination value that is too high or too low does to false positives and missed anomalies - How to validate the threshold and keep it right as the data drifts ### Follow-up Questions - You have no labels at all. How would you estimate recall at a given threshold? - The flagged rate doubles overnight with no change to the threshold. What do you check first? - How do you turn the cost of a false alarm and the cost of a missed anomaly into a threshold? - Should the threshold be global or set per segment (per merchant, per region), and what does each choice cost?

Overview: Asks how to set the score cutoff or contamination rate for an outlier detector. Tests use of prior anomaly rates, labeled validation data, error costs and review capacity, and how to validate and maintain the threshold as the data drifts.

PracHub logo
General
Nov 25, 2026
mediumData ScientistOtherStatistics & Math
0
0

How do you choose an appropriate threshold or contamination rate for an outlier detector?

What a Strong Answer Covers Guidance

  • Treating the detector's output as a score and the threshold as a separate decision
  • Ways to set the cutoff with labels, with error costs, with a review budget, and with no labels at all
  • What a contamination value that is too high or too low does to false positives and missed anomalies
  • How to validate the threshold and keep it right as the data drifts

Follow-up Questions Guidance

  • You have no labels at all. How would you estimate recall at a given threshold?
  • The flagged rate doubles overnight with no change to the threshold. What do you check first?
  • How do you turn the cost of a false alarm and the cost of a missed anomaly into a threshold?
  • Should the threshold be global or set per segment (per merchant, per region), and what does each choice cost?