Course contentsShow
← Data Science
Lesson 1409 of 2,14535. Statistical Anomaly DetectionFree lesson

Setting Detection Parameters

Choosing significance level, maximum anomalies, and seasonal period parameters to balance sensitivity and false positives.

Setting Detection Parameters

You'll learn: How to tune Seasonal Hybrid ESD parameters—significance level, maximum anomalies, and seasonal period—to find the right balance between catching real outliers and avoiding false alarms.

The Balancing Act

Think of anomaly detection like setting a home security system. Too sensitive, and every passing car triggers an alarm. Too lenient, and you miss actual break-ins. Detection parameters control this trade-off.

The Three Key Parameters

Significance Level (alpha)

This controls how statistically "extreme" a point must be to qualify as an anomaly. Common values: 0.05 (95% confidence) or 0.01 (99% confidence).

  • Lower alpha (e.g., 0.01): Fewer false positives, but may miss subtle anomalies
  • Higher alpha (e.g., 0.10): More detections, but more false alarms

Maximum Anomalies

Limits how many outliers the algorithm can flag. This prevents contamination—when too many anomalies corrupt the baseline statistics.

  • Set based on domain knowledge: "I expect at most 5% of points to be anomalous"
  • Too high: True anomalies dilute detection power
  • Too low: Later anomalies go undetected

Seasonal Period

Tells the algorithm how often patterns repeat (e.g., 7 for weekly data, 12 for monthly).

  • Correct period: Algorithm properly separates normal seasonal peaks from true anomalies
  • Wrong period: Seasonal spikes get flagged as false positives, or real anomalies blend into "normal" variation

Tuning Strategy

Start conservative (alpha=0.05, max_anomalies=10% of data points, known seasonal period). Review flagged points. If too noisy, tighten; if missing obvious outliers, loosen.

Key Takeaway: Detection parameters require iterative tuning based on your data's characteristics and tolerance for false positives versus false negatives—there's no one-size-fits-all setting.