Semi-supervised Isolation Forest
- Introduced by
- Extended from Liu, F.T., Ting, K.M., and Zhou, Z-H. (iForest, 2008); semi-supervised variants developed by multiple authors ca. 2013–2020
- Year
- 2013–2020
- Type
- Ensemble anomaly detection (semi-supervised extension)
- Family
- Machine learning
What does it do?
Semi-supervised Isolation Forest extends the classic Isolation Forest anomaly detector by incorporating a small set of labeled anomaly (and possibly normal) examples alongside a large unlabeled dataset.
This label guidance adjusts the model's anomaly scores so that known anomalies are separated more reliably, bridging the gap between fully unsupervised and fully supervised detection.
The intuition behind the method
Standard Isolation Forest scores anomalies by how quickly a random tree isolates a point — anomalies are isolated in fewer splits. But without any labels the model has no feedback about what actually counts as anomalous in your domain. Semi-supervised Isolation Forest introduces a small number of confirmed examples (known anomalies, or known normals, or both) and uses them to calibrate or re-weight the scoring process. The result is that the forest's inherent separation power is steered toward the anomaly patterns that actually matter, substantially reducing false alarms and missed detections without requiring a fully labeled training set.
History
Isolation Forest was introduced by Liu, Ting, and Zhou in 2008 as a purely unsupervised anomaly detector based on random recursive partitioning. Recognising that even a few labels can dramatically improve detection, researchers from roughly 2013 onward developed semi-supervised extensions that incorporate label guidance into the scoring or tree-weighting process. Related theoretical groundwork on supervised anomaly detection was laid by Görnitz et al. (2013), and practical SSIF variants appeared in applied venues addressing fraud detection and network intrusion through the late 2010s.
When to use it
Use Semi-supervised Isolation Forest when you have a large pool of unlabeled data, the cost of full labeling is prohibitive, but you can obtain labels for at least a small set of confirmed anomalies (and optionally some confirmed normals). It is especially valuable for rare-event detection in cybersecurity, fraud, predictive maintenance, and medical monitoring where domain experts can label a handful of known incidents. Do not use it when no labeled anomalies are available at all (prefer standard Isolation Forest or One-Class SVM), when data is high-dimensional and sparse without preprocessing, or when a large fully labeled set is already available (a fully supervised classifier will outperform it).
Limitations and considerations
- Performance degrades if the labeled anomalies are not representative of the anomaly distribution in the unlabeled data.
- The optimal label-integration mechanism varies across implementations; no single universally dominant variant exists yet.
- Like standard iForest, it can struggle with anomalies clustered near the data centre or with certain multimodal distributions.
- Requires care to avoid label leakage when evaluating: the labeled set must not overlap with the test set.
Source conditions do not replace independent scientific review or validation by an analysis engine.
Strengths
- Achieves higher precision and recall than fully unsupervised iForest by anchoring scores to real labeled anomalies.
- Requires only a small number of labels, making it practical when annotation is expensive.
- Inherits iForest's sub-linear training time and low memory footprint, scaling to large datasets.
- Handles high-dimensional tabular data without distance or density assumptions.
- Reduces arbitrary threshold selection: the labeled subset provides a principled calibration basis.
Applications
- Network intrusion detection using a handful of confirmed attack samples alongside normal traffic.
- Financial fraud detection where only a small set of confirmed fraudulent transactions is available for labeling.
- Predictive maintenance: using confirmed failure events to calibrate anomaly scores on sensor streams.
- Medical monitoring: guiding anomaly scoring with confirmed pathological cases from electronic health records.
- Quality control in manufacturing where only a subset of defective units has been independently verified.
How it works
How it works
The available data are split into a small labeled subset — containing confirmed anomalies, confirmed normals, or both — and a large unlabeled pool. The labeled subset is small by design; obtaining full labels is usually costly or impractical, which is precisely the scenario this method targets.
An ensemble of isolation trees is grown on random subsamples of the full dataset (labeled plus unlabeled), following the standard iForest procedure: at each internal node, a random feature and a random split value within that feature's range are chosen to recursively partition data until each point is isolated.
Each observation receives an anomaly score derived from its average path length across all trees. Shorter average paths — meaning easier isolation — yield higher anomaly scores. The normalised score s(x, n) maps to (0, 1], with values near 1 indicating strong anomaly candidates.
Formula
s(x, n) = 2^{-E[h(x)] / c(n)}The labeled examples are used to adjust the model: depending on the variant, this may involve re-weighting trees or splits that correctly separate known anomalies from normals, adding a supervised loss term to the score aggregation, or using the labeled set to learn a decision boundary on top of the unsupervised scores. This step is the defining difference from standard iForest.
A threshold is applied to the adjusted anomaly scores to produce binary anomaly / normal decisions. The labeled subset enables data-driven threshold selection — for instance, choosing the cut-off that maximises F1 on the labeled examples — rather than relying on an arbitrary percentile.
Common pitfalls
- Using only anomaly labels and ignoring normal labels when both are available — incorporating confirmed normals can further sharpen the decision boundary.
- Evaluating on a test set that includes the labeled training examples, inflating performance metrics.
- Choosing the anomaly score threshold by a fixed percentile instead of using the labeled set for calibration.
- Assuming the method is robust when labeled anomalies cover only one subtype while the unlabeled pool contains diverse anomaly patterns.
- Neglecting to preprocess high-dimensional or mixed-type features before fitting, which can skew random split selection.
Frequently asked questions
How many labeled anomalies do I need?
Even a handful — sometimes as few as 10–50 confirmed anomalies — can provide meaningful calibration. The key requirement is that they are representative of the anomaly types present in the unlabeled pool. More diverse label coverage across anomaly subtypes generally yields larger gains.
How is this different from standard Isolation Forest?
Standard Isolation Forest is fully unsupervised and scores anomalies solely by path length without any domain feedback. Semi-supervised Isolation Forest incorporates a small labeled set to adjust scores or tree weights, steering the model toward anomaly patterns that are actually relevant in your domain and enabling principled threshold calibration.
Can I include labeled normal examples as well as anomalies?
Yes, and it is generally beneficial. Labeled normals help the model distinguish boundary cases more sharply. Some variants treat the labeled set as a balanced reference for calibrating the scoring function, so including both classes when available improves the decision boundary.
Should I use cross-validation to evaluate the model?
Yes, but carefully. The labeled subset must be excluded from or properly stratified in the test set to avoid data leakage. A stratified train/test split on the labeled portion, combined with the full unlabeled pool for training, is the standard evaluation setup.
What if my labeled anomalies are not representative?
Label-guided adjustment can backfire if the labeled anomalies cover only a narrow slice of the true anomaly distribution. In that case, the model may miss novel anomaly types it was never shown. It is advisable to complement semi-supervised detection with unsupervised anomaly scoring and monitor for distributional drift in production.
Related methods
Sources
Görnitz, N., Kloft, M., Rieck, K., & Brefeld, U. (2013). Toward supervised anomaly detection. Journal of Artificial Intelligence Research, 46, 235–262.
Open publication referenceCopied.Isolation Forest. Wikipedia.
Open publication referenceCopied.