Preference isolation forest for structure-based anomaly detection

Filippo Leveni, Luca Magri, Cesare Alippi, Giacomo Boracchi

TL;DR

Traditional anomaly detection algorithms look for data points in low-density regions, but what happens when anomalies are densely packed yet structurally wrong? This paper introduces Preference Isolation Forest (PIF), an unsupervised framework that maps data into a high-dimensional "preference space" based on geometric structures, allowing anomalies to be easily isolated as points that simply don't fit the expected patterns.

What Problem Does This Paper Address?

Most classic anomaly detection methods (like Isolation Forest or Local Outlier Factor) operate under a simple assumption: anomalies live in low-density regions of the ambient data space. However, in many real-world applications—such as 3D point cloud scans or image template matching—genuine data points naturally lie on low-dimensional geometric structures or manifolds (e.g., lines, planes, or circles).

Anomalies in these scenarios might represent structural defects (like cracks or mismatches) that could actually be quite dense, confusing standard density-based detectors. While one could try to explicitly fit multiple geometric models to find outliers, multi-model fitting is computationally expensive and highly sensitive to initialization. The authors tackle this gap by proposing a method that detects structural anomalies directly and unsupervised, without needing to explicitly solve the complex multi-model fitting problem first.

PIF pipeline showing how data is mapped from the input space to a preference space where anomalies naturally isolate.

Methods

The Preference Isolation Forest (PIF) framework consists of two main stages:

  1. Preference Embedding: The algorithm randomly samples a pool of $m$ parametric models from a user-defined family $\mathcal{F}$ (e.g., lines or planes) using a RANSAC-like strategy. Every data point is then mapped to a high-dimensional preference vector, where each coordinate represents how well that point conforms to a specific sampled model.
  2. Preference Isolation: Because anomalies do not conform to the genuine structures, their preference vectors are sparse and nearly orthogonal to those of genuine data. This makes them highly isolated in the preference space.

To isolate these points efficiently, the authors introduce three tree-based variants:

  • Voronoi-iForest: The most general variant, which recursively partitions the preference space using nested Voronoi tessellations. It can adapt to any custom distance metric (such as Tanimoto or Ruzicka distances).
  • RuzHash-iForest: A highly optimized variant that replaces expensive point-to-point distance calculations with a custom Locality Sensitive Hashing (LSH) scheme called RuzHash, speeding up the tree-building process significantly.
  • Sliding-PIF: Designed for spatial data (like 3D surfaces), this variant applies PIF within localized, overlapping sliding windows. This allows simple models (like planes) to approximate complex, globally curved manifolds.
An illustration of how different model families can be used to locally approximate complex structures.

Datasets

The authors evaluated PIF across both synthetic and real-world benchmarks:

  • Synthetic 2D Primitive Fitting: Points distributed along lines or circles, corrupted by uniformly distributed anomalies.
  • AdelaideRMF: A real-world computer vision dataset containing stereo images where anomalies are feature mismatches (outliers to homographies or fundamental matrices).
  • MVTec-3D AD: A real-world 3D anomaly detection dataset containing range images of various objects. The authors split this into smooth objects (cookie, peach, potato, carrot) and mechanical objects (cable gland, dowel, foam, rope, tire) to test the limits of their local smoothness assumptions.

Key Insights and Ideas

  • Shifting the Perspective: Instead of measuring density in the original coordinate space, PIF measures structural consistency in a preference space.
  • Anomalies as Orthogonal Outliers: Because anomalies fail to achieve consensus with virtually any valid structural model, their preference vectors naturally become sparse and orthogonal to the rest of the dataset, making them exceptionally easy to isolate via random splits.
  • Locality as a Power-Up: Globally complex shapes are often impossible to define with a simple parametric equation. However, by using a sliding window approach (Sliding-PIF), the authors show that complex shapes can be broken down into locally simple structures (like treating a smooth sphere as a collection of small flat planes).

Key Results

  • Superior Accuracy: PIF consistently outperformed standard Isolation Forest (iFor), Extended Isolation Forest (EiFor), and Local Outlier Factor (LOF) on structured datasets, particularly when the genuine structures had highly uneven densities.
Qualitative comparison showing PIF successfully identifying anomalies inside a circular structure where ambient-space methods fail.
  • Massive Speedups: By avoiding explicit distance computations, RuzHash-iForest achieved a 35% to 70% reduction in execution time compared to Voronoi-iForest while maintaining virtually identical detection accuracy.
  • Effective 3D Defect Detection: On the MVTec-3D dataset, Sliding-PIF achieved high Area Under the ROC Curve (AUC) scores (up to 0.98) on smooth objects without requiring any training data or deep learning overhead.

Limitations and Future Work

  • Dependence on Structural Priors: PIF requires prior knowledge about the type of geometric structures present in the genuine data (e.g., knowing whether to look for lines, circles, or planes). If the chosen model family poorly matches the data, performance degrades (as seen on highly irregular "mechanical" objects like foam).
  • Embedding Computational Cost: Generating the preference embedding requires fitting a large pool of candidate models, which can become a bottleneck for massive datasets.

The authors suggest that future work will explore integrating non-parametric or learned model families into the embedding process, alongside developing parallelized or GPU-accelerated implementations to scale up the embedding step.

Summary updated

BibTeX
@article{leveni2026preference,
  author = {Filippo Leveni and Luca Magri and Cesare Alippi and Giacomo Boracchi},
  title = {{Preference isolation forest for structure-based anomaly detection}},
  journal = {Pattern Recognition},
  year = {2026},
  doi = {10.1016/j.patcog.2025.112405},
}
Figure