← All Posts
Machine Learning · Anomaly Detection

Anomaly Detection: Reading Guide

Isolation Forest isolates observations through random axis-aligned cuts: points separated in fewer cuts receive higher anomaly scores. Turning that score into a reliable production workflow requires three pieces: a well-defined telemetry feature row, a calibrated forest score, and a grouped review queue.

Three artifacts make the workflow reviewable

Define the observation → calculate the score → admit a case
1 · Feature contractApp–tenant pair, seven-day window, event count, exposure, collection coverage, and peer reference.

A rate of 6 is meaningful only after its unit and exposure denominator are defined.

Inspect the row’s meaning
2 · Fitted detectorSaved training reference, feature transforms, trees, path correction, score direction, and version.

Shorter average paths produce larger anomaly scores.

Inspect the actual trees
3 · Reviewable caseGrouping key, member evidence, admission rank, budget rule, and timestamped outcomes.

A three-case limit must count investigations, not duplicate rows.

Inspect the admitted cases
Changing a cutoff changes labels without changing the forest. Changing a feature’s geometry changes the forest itself. Grouping changes what the review budget counts.

Three chapters, three questions

Quick concept lookup

Direct routes to each core mechanism and edge case.
Behavior or edge caseWhere it is derived
Queries 20 and 100 receive the exact same score.Existing leaves and unseen queries
The predicted outlier label changes while the ranking stays fixed.Raw scores versus threshold offsets
The global rate looks normal ($2.04$) despite a $3\times$ local spike ($6.0$).Aggregation unit and Simpson masking
$\operatorname{log1p}$ preserves ordering but shifts random cut probabilities.Uniform draws in transformed coordinates
Zero events may mean a logging outage or zero exposure.Coverage and eligibility states
Three admitted rows collapse into a single investigation.Grouping before applying the budget
A negative SHAP value ($-1.4667$) increases the anomaly score.Path-space vs. score-space attributions

Reproduction scripts and related chapters

Every number and figure in this series is generated from small, inspectable fixtures: the forest script (JSON fixture), the cut-geometry script (CSV values), and the queue grouping implementation (JSON fixture). For multi-feature SHAP attributions on trees, see the Isolation Forest SHAP chapter; for precision, recall, and outside-queue auditing, see Evaluate Graph Risk.