Manuscript Offprint
arXiv:2610.12244RIFT: Relative Isolation From Trees For Anomaly Detection
Abstract
Isolation Forest (IF) is a widely used baseline for unsupervised anomaly detection. Recent studies provide a closed-form expression for the infinite-forest limit for one-dimensional data. Inspired by the geometric interpretation of this formula, we introduce RIFT (Relative Isolation From Trees), a deterministic anomaly detection method that generates the minimum spanning tree and scores each point by the sum of the apparent sizes of tree edges as viewed from that point. For one-dimensional data, the RIFT score recovers the closed-form IF limit exactly. In higher dimensions, it provides a parameter-free generalization that is deterministic, robust to varying density and clustered anomalies and avoids the axis-parallel artifacts of IF. We further propose an ensemble variant for large datasets. Experiments on synthetic data and the ADBench benchmark demonstrate that the accuracy is comparable to IF, while the ensemble variant exhibits significantly lower variance across random seeds.
Keywords: anomaly detection, outlier detection, ensemble, unsupervised learning, machine learning
1 Introduction
Today, vast amounts of data are generated across various domains, including IT systems, industry, finance, and healthcare . Machine learning tools enable the automated detection of anomalies, or outliers, within these datasets. An anomaly is generally defined as a data point that deviates significantly from the majority, suggesting it was generated by a different underlying process [3]. Often, anomalies are identified simply to be removed, as they may result from measurement or data collection errors that could distort the analysis. In many other cases, however, the anomalies themselves hold the most valuable information: they might indicate diseases in medical diagnostics [4], cyberattacks in IT security [5], or subtle equipment malfunctions in industrial systems [6] that are difficult for human operators to detect.
A vast number of anomaly detection methods has been proposed in the literature. These include techniques designed for time-series data [7], graph-based methods [8], and algorithms tailored for textual data (such as system logs) [9]. Another major category focuses on detecting "point anomalies" within multidimensional tabular data [10], assuming no underlying sequential or temporal structure among the independent samples. In this paper, we introduce a novel algorithm that falls into this latter category.
While supervised machine learning can be used for anomaly detection, it faces two significant challenges. First, it requires large amounts of labeled training data . Second, supervised models tend to overfit to known anomaly patterns rather than learning the boundaries of normal behavior, making them blind to novel, previously unseen types of outliers . The method proposed in this paper is strictly unsupervised. It does not require any pre-labeled training data, which is often impractical or impossible to obtain in real-world scenarios, and separates anomalies from normal instances based solely on the intrinsic properties of the data itself.
One of the most renowned algorithms in this unsupervised domain is the Isolation Forest (IF) [13]. Based on a simple yet elegant concept, IF is robust, fast, and provides accurate results both on small and large datasets. The algorithm introduced in our paper shares conceptual similarities with the Isolation Forest but operates on entirely different mechanics. For one-dimensional data, our method yields the exact same results as an Isolation Forest containing an infinite number of trees, each grown on the full sample without a height limit. In higher dimensions, our approach utilizes an anomaly scoring metric analogous to IF, but computes it through a fundamentally different, deterministic process based on geometric distances rather than random recursive partitioning. Consequently, our algorithm is not a mere derivative of existing techniques, but a novel method that broadens the landscape of anomaly detection algorithms.
The rest of the paper is organized as follows. First, Section 2 reviews the related literature and anomaly detection methods. Following this, in Section 3, we revisit the Isolation Forest algorithm, detailing its closed-form asymptotic solution for 1D data and its geometric interpretation. The proposed algorithm is then introduced in Section 4, starting with the exact methodology, followed by a fast but highly accurate approximation, and concluding with a scalable ensemble-based variant designed for large datasets. In Section 5, we evaluate the performance of our approach on synthetic data as well as standard benchmark datasets from ADBench, comparing it against several widely used anomaly detection techniques. Finally, Section 6 provides the concluding remarks.
A complementary line of work formulates anomaly detection as novelty detection via one-class classification. One-Class SVM (OCSVM) learns a decision boundary that encloses the bulk of the data in feature space and flags points falling outside as anomalies .
Distance- and neighborhood-based methods score a point by its proximity to other samples. Classical k-nearest-neighbor (KNN) outlier scores use distances to the k-th neighbor (or related aggregates) and are attractive due to their simplicity, but can become expensive in high dimensions without approximate indexing [16].
Density-based approaches aim to separate points in sparse regions from those in dense regions. The Local Outlier Factor (LOF) compares a point's local density to the densities of its neighbors, thereby capturing local outliers even when global density varies [17]. Cluster-based methods such as CBLOF first summarize the data into clusters and then assign higher outlierness to points that belong to small clusters or are far from large clusters [18].
Histogram- and distribution-based detectors trade modeling flexibility for scalability. HBOs assumes feature independence and computes outlierness from per-feature histograms, resulting in very fast scoring on large datasets [19]. More recent methods such as COPOD and ECOD avoid explicit density estimation by using copulas or empirical cumulative distribution functions to derive robust, parameter-light outlier scores [20, 21].
Ensemble methods provide another effective route to scalability and robustness. Isolation Forest (IF) isolates anomalies via random recursive partitioning and remains a strong general-purpose baseline [13]. LODA takes an alternative lightweight ensemble approach: it builds multiple one-dimensional random projections and uses simple histograms in the projected spaces to score outliers efficiently [22].
Overall, these methods highlight a spectrum of trade-offs between computational cost, robustness to dimensionality and density variation, and the extent to which the detector exploits global versus local geometric structure. Our proposed method is most closely related to geometric, distance-driven detectors, but it derives its isolation score from the structure of a (possibly approximated) minimum spanning tree rather than from random partitions or explicit density models.
3 Isolation Forest
3.1 The basic algorithm
Isolation Forest (IF) is an ensemble method that detects anomalies by how easily they can be isolated via random recursive partitioning [13]. Let . An IF model builds isolation trees, each grown from a random subsample of size .
An isolation tree is constructed recursively. At a node containing points , sample a feature index uniformly at random and then sample a split value uniformly from . Split into left/right children by the threshold on feature . Recursion stops when (or all points in are identical) or when a maximum depth is reached.
For a point , let be its path length (number of edges traversed from the root to the external node) in tree . The forest-average path length for is
To normalize for sample size, IF uses the average path length of an unsuccessful search in a binary search tree,
where is the m-th harmonic number. The standard anomaly score is then
so that smaller (easier isolation) yields larger anomaly scores.
Many variants of the IF algorithm have been proposed. Some change the way samples are randomly split (e.g., Extended Isolation Forest [23]), while others adapt it to the online setting (e.g., BWOAIF [24] and IForestASD [25]). In this paper, we consider only the original algorithm.
3.2 Explicit solution for one-dimensional data
Theorem 3.5 of [26] gives an exact closed-form expression for the expected depth (i.e., the expected path length) assigned by IF in the one-dimensional setting, given an ordered sample , for isolation trees grown on the full sample without a height limit. The expected depth of point , denoted by , obtained at , can be written explicitly in terms of the spacings between adjacent points:
This result makes it possible to obtain the 1D IF anomaly score from the sample geometry, rather than only via Monte Carlo over random trees. Appendix A provides an alternative proof that reaches the same results in a few elementary algebraic steps.
The authors of [26] also argue that (4) does not extend trivially to . In higher dimensions, the expected depth depends on the full relative configuration of the points in , not merely on their ordering along a line, so different point arrangements can lead to genuinely different functional forms. Moreover, since each split is made along a

Fig. 1 Components of the explicit solution of the anomaly score for
randomly chosen coordinate, both the set of admissible splitting coordinates and the resulting transition structure may change after every split. As a consequence, the size of an exact state-space description of the process grows rapidly with the dimension.
4 Description of the proposed method
4.1 Concept of the algorithm
Although the exact solution of is not known for , we can develop new anomaly detection methods inspired by the geometric interpretation of the one-dimensional result.
To understand the mechanics of the closed-form 1D solution (4), it is helpful to interpret the summation geometrically, as illustrated by the example in Figure 1. Using the notation introduced in the example, with as the target point, the anomaly score given by (4) can be rewritten as
Each term in Equation 5 describes a geometric ratio from the perspective of the target point in Figure 1):
• The numerator represents the length of the empty space between consecutive data points (the 1D edges). This captures the local sparsity of that specific region.
• The denominator represents the “line-of-sight” distance from the target point to the evaluated edge (specifically, its further endpoint). This penalizes the impact of an edge based on its distance from the target.
Geometrically, this quotient can be interpreted as the 1D apparent size (or 1D visual angle) of the segment as observed from . The isolation of a point is given by the sum of these apparent sizes.
In the 1D scenario, the spatial ordering of data points is trivial and the terms of the summation rely on a strictly defined sequence of edges and distances. The topological structure is a simple linear chain. If we observe the environment from a target point, every other node in the sequence is associated with exactly one adjacent edge leading further away from the target. Consequently, there is a perfect one-to-one mapping between the evaluated nodes and the spatial gaps they represent.

Fig. 2 Components of the proposed algorithm in 2D
In the sequel, we generalize this mathematical framework to higher-dimensional spaces . In higher-dimensional space, however, edge selection is a critical, non-trivial question. To adapt the geometric ratio obtained in 1D, we must find a graph structure that preserves the aforementioned topological properties. We propose the Minimum Spanning Tree (MST) based on Euclidean distances as the skeletal representation of the data.
When an MST is constructed over the dataset, it creates a fully connected, cycle-free graph. If we temporarily view the target point as the root of this tree, the MST branches outwards to connect all other points. In any directed tree, every node (except the root) has exactly one incoming edge. Therefore, for any given node , we can uniquely assign the length of the MST edge connecting it to its parent (in the direction of the target) as the numerator . The denominator naturally generalizes to the direct Euclidean distance between the target point and the node (see Figure 2).
A normal point (deeply embedded within a cluster) is surrounded by numerous local edges at short distances ( ). The sum of these “apparent sizes” ( ) accumulates to a relatively large value, analogous to a deep terminal node in a standard Isolation Tree. An anomalous point lies far from most of the data. From such a point, dense clusters are distant (large ), while their internal edges ( ) remain relatively small, shrinking their quotient to nearly zero. The primary contribution to the sum comes solely from the long bridging edge that connects the anomaly to the rest of the graph, making the total small. Defining the final anomaly score as the negative of , the algorithm produces low scores for normal samples and high scores for anomalies.
This MST-based formulation provides an important theoretical consequence: if we apply this d-dimensional MST approach to one-dimensional data, it perfectly recovers the exact 1D closed-form solution given by eq. (5). In 1D, the MST naturally degenerates into the sequential linear chain connecting adjacent points, meaning that the MST edges and the distances become mathematically identical to those of our original 1D derivation.
Note that relying on the MST is a design choice. Since higher-dimensional spaces lack absolute ordering, the selection of the topological backbone is an open question. Other edge-selection strategies could also be employed to define . Nevertheless, the MST provides a parameter-free, globally connected, and theoretically sound generalization.
The proposed geometric metric is inherently density-invariant. Since the topological relationship is evaluated as a quotient , scaling the density of a cluster proportionally scales both the local empty spaces and the perspective distances , leaving the resulting sum effectively unchanged. This self-normalization allows the algorithm to recognize that a point within a sparse cloud is topologically just as normal within its own local context as a point in a tightly packed core.
Following the geometric interpretation described above, we name the proposed method RIFT (Relative Isolation From Trees).
4.2 The exact solution using MST
The baseline algorithm is shown in Algorithm 1. To calculate the anomaly scores for all samples, it is enough to construct the MST only once. The main loop iterates over all sample points and selects them as target. The body of the loop is basically a breadth-first traversal of the MST starting from the target point. One traversal is enough to get the anomaly score for the target point. Note that is not the anomaly score itself, it is similar to the expected tree height of isolation forests, for which a lower value means higher anomaly score. It can be scaled to the range similar to eq. (3), but it can also be used directly for the ROC-AUC tests.
The main drawback of the algorithm is the computational complexity and memory requirement of the MST construction, due to which it can be applied only on datasets of moderate size.
4.3 Using MST approximations
While computing with the exact MST (Section 4.2) provides a strong baseline, constructing and traversing a single global MST becomes impractical on large datasets ( ).
To reduce this cost, we approximate the MST using a sparse k-nearest-neighbor (kNN) graph: for each sample we keep only edges to its k closest neighbors and compute an MST on this reduced edge set.
We start from the kNN graph and build an MST on it. If the kNN graph is not connected, we increase k and repeat until the graph (and thus the resulting MST approximation) becomes connected.
Let be the number of vertices (samples) and let be the number of edges in the graph. Classical MST algorithms such as Kruskal's run in time. For a fully connected graph we have , which makes exact MST construction expensive. In contrast, a kNN graph has roughly edges, which is far cheaper when .
In some datasets we encountered many duplicate samples (thousands of points at exactly the same location). This can force k to grow very large before the kNN
Algorithm 1 RIFT-exact: Global MST Isolation Score (Baseline)
Require: Dataset
Ensure: Anomaly scores
1: Initialize a complete graph where
2: Construct the Minimum Spanning Tree (MST) from
3: Initialize an empty array of size
4: for each target point do
5:
6: Initialize a queue
7: Initialize a set of visited nodes
8: while is not empty do
9: Pop current node from
10: for each neighbor of in the MST do
11: if then
12: Add to
13: Push to
14:
15:
16:
17: end if
18: end for
19: end while
20: Negative sum assigns higher scores to anomalies
21: end for
22: return
graph becomes connected, which hurts runtime. A simple workaround is to build the approximate MST on the set of unique samples and then map duplicates back to their representative node. This solution keeps the graph sparse while still representing every sample.
4.4 Ensemble-based implementation
As another option to avoid the calculation and the traversal of huge MSTs and to enhance the robustness of the detector, we propose an ensemble-based approach inspired by the sub-sampling and feature bagging (random subspace) strategies. Instead of constructing a single global tree, we build a forest of independent Minimum Spanning Trees. Each tree is constructed from a small, randomly selected subset of the data instances (typically ), and evaluated over a randomly selected subset of features .
The isolation score of a target point (which may or may not have been part of the training subset) is evaluated as follows. For a given tree , the geometric distances are computed exclusively within its respective feature subspace . We first identify the connection point (anchor) that is closest to the target point in this subspace:
The target point is attached to the tree as a new leaf node connected to via an edge of length d_* = \|x_i - x^*\|_F_j. The isolation value for the point relative to the tree is then computed as the sum of the apparent sizes of all edges in the augmented tree:
In eq. (7), for all nodes already present in , the numerator is the pre-calculated MST edge weight within the subspace , while the denominator is the Euclidean distance between and in the same subspace. The final isolation score is obtained by averaging the results over the entire forest:
This ensemble approach significantly reduces the computational overhead, as the complexity of constructing and traversing M small trees is significantly lower than that of a single global MST. The forest structure combined with feature bagging introduces further statistical advantages. Sub-sampling reduces the masking effect, where a tight cluster of anomalies might otherwise appear as a dense normal region according to the global detector. By isolating members of such micro-clusters in different subsamples, they get revealed as outliers. The ensemble approach also prevents swamping, ensuring that redundant normal instances in high-density regions do not inflate the isolation scores of distant anomalies. Furthermore, feature bagging mitigates the curse of dimensionality, preventing irrelevant or noisy features from dominating the distance calculations across the entire forest.
It is important to note that while the introduction of data sub-sampling and feature bagging makes the algorithm non-deterministic, the MST-Forest exhibits a higher level of structural consistency than the traditional Isolation Forest. The Isolation Forest relies on pervasive randomness: stochastic sub-sampling followed by completely random axis selection and split-point partitioning at every single node of every tree. Our method limits randomness strictly to the initial instance and feature sampling phase of each tree. Once a data subset and a feature subspace are selected, the resulting MST provides a deterministic representation of the local topology within that specific view. Consequently, the MST-Forest maintains the robustness of ensemble methods while exhibiting lower variance in its anomaly scores.
Algorithm 2 RIFT-ensemble: Sub-sampled MST-Forest with Feature Bagging
Require: Dataset , Number of trees , Sub-sample size , subset size
Ensure: Ensemble anomaly scores
1: Initialize an array of size with zeros
2: for to do
3: Draw a random subset of instances of size
4: Draw a random subset of features of size
5: Construct a complete graph on where weight(u, v) = \|u - v\|_F_m
6: Construct the Minimum Spanning Tree from
7: for each target point do
8: // Phase 1: Topological Grafting (Anchor Selection in Subspace)
9: Find anchor node x^* \leftarrow \arg\min_{v \in X_m} \|x_t - v\|_F_m
10: d_{hook} \leftarrow \|x_t - x^*\|_F_m
11: \ell_{hook} \leftarrow \|x_t - x^*\|_F_m
12:
13: // Phase 2: Tree Traversal (Referencing Algorithm 1)
14: Traverse via BFS starting from identically to Algorithm 1:
For each newly visited node , accumulate into , where:
is the incoming edge weight in
\ell_v = \|x_t - v\|_F_m
15:
16: end for
17: end for
18: for to do
19:
▷ Average over the forest and negate
20: end for
21: return
5 Numerical study
The proposed method was implemented in Python, utilizing the Numba library for computational optimization. To ensure accessibility and ease of integration, the implementation provides an API that is fully consistent with standard scikit-learn estimators.
Since the algorithm relies on Euclidean distances, proper feature scaling prior to execution is critical. However, because anomalies frequently distort data distributions in an asymmetric manner, traditional standardization or min-max scaling are not optimal. For the numerical experiments presented in this paper, we applied a robust scaling approach that can properly handle the influence of extreme outliers: we used the median and the MAD, applied on the unique data points, to scale each feature.

Fig. 3 Synthetic datasets used in the comparison
5.1 Anomaly heatmaps with synthetic data
The way anomalies are distributed strongly affects how well different detectors perform. In this section we show that the proposed method handles two situations that are difficult for many detectors: datasets with varying density, and anomalies that form tight clusters. It handles both by construction, without hyperparameters, and deterministically.
We use the three synthetic datasets shown in Figure 3. The first contains two perpendicular Gaussian blobs, with the anomalies grouped around two points. The second illustrates varying density: the normal data form one sparse and one dense cloud, while the anomalies are arranged in a ring around the dense cloud. In the third, the anomalies form a single tight cluster.
The methods compared are Isolation Forest, KNN (which we will later see is surprisingly effective on real data), LOF (which handles varying-density data particularly well), and two further methods, HBOS and ECOD.
The ROC AUC results are summarised in Table 1. LOF and KNN perform very well on the Blob and Varying-density datasets but poorly on the Clustered-anomalies dataset, while HBOS and ECOD show the opposite pattern. Isolation Forest and the proposed method achieve high ROC AUC in both regimes — the proposed method while also producing deterministic results.
| Method | Blob | Varying density | Clustered anomalies |
|---|---|---|---|
| Isolation Forest | 0.995 | 0.961 | 0.956 |
| LOF | 0.999 | 1.000 | 0.365 |
| KNN | 0.995 | 0.846 | 0.002 |
| HBOS | 0.324 | 0.432 | 0.947 |
| ECOD | 0.526 | 0.656 | 0.983 |
| RIFT (proposed) | 0.999 | 0.982 | 0.993 |
Table 1 ROC AUC scores on the synthetic datasets

Fig. 4 Anomaly scores on the “blobs” dataset
The heatmaps (Figures 4, 5, 6) are informative on how the methods behave. Isolation Forest produces axis-parallel artifacts, LOF radial ones, and HBOS a blocky, axis-parallel surface. For KNN, anomalies close to a cluster are assigned normal scores too quickly. RIFT, the proposed method, yields a smooth anomaly surface, free of such artifacts.
Thanks to the use of a reachability-based distance, LOF is known to handle varying-density data well, and to some extent clustered anomalies. As Figure 7 shows, LOF performs well on the varying-density dataset, but on the clustered-anomaly dataset its performance collapses once the anomaly cluster grows larger than its parameter k. On that dataset ECOD performs well. The proposed method is strong in both cases, and achieves this without any hyperparameter.
No anomaly detector is perfect, each has its own weakness. In the following sections we use real data to also show which kinds of anomalies the proposed method handles less well.
5.2 Evaluation of the ensemble based approach
The ensemble-based approach is characterized by three hyper-parameters:
• the ensemble size (the total number of generated trees),
• the number of data samples per tree (the degree of data sub-sampling),
- the feature bagging ratio (the fraction of the total dimensions considered during the construction of a given tree).

Fig. 5 Anomaly scores on the “varying density” dataset

Fig. 6 Anomaly scores on the “clustered anomalies” dataset


Fig. 7 Performance of anomaly detection methods on two synthetic datasets
| Dataset | Samples | Features | Category |
|---|---|---|---|
| anthyroid | 7200 | 6 | Healthcare |
| magic.gamma | 19020 | 10 | Physical |
| mammography | 11183 | 6 | Healthcare |
| mnist | 7603 | 100 | Image |
| satellite | 6435 | 36 | Astronautics |
Table 2 Datasets used in the comparison
In this section, we investigate the empirical impact of these parameters using several standard benchmark datasets.
First, feature bagging is disabled to investigate the impact of the remaining two hyper-parameters. Initially, both parameters are set to sufficiently large baseline values and their effects are observed by systematically decreasing them one at a time. The evaluation is conducted using the benchmark datasets detailed in Table 2, which are diverse in terms of sample size, dimensionality, and application domain. Each configuration is executed 100 times using different random seeds.
The top part of Table 3 presents the average AUC results across 100 independent runs for various ensemble size configurations. The results achieved with an exceptionally small number of trees are remarkably close to those obtained with massive forests. However, increasing the size of the ensemble provides a clear benefit in terms of the variance of the results. As shown in the middle part of Table 3, the already low variance observed with a few trees approaches zero as the number of trees exceeds one hundred.
The results also indicate that, in most scenarios, the ensemble approach closely approximates the performance of the exact MST baseline while being superior in terms of computational efficiency.
However, for the satellite dataset the ensemble method performed significantly worse than the exact approach. The reason could be that by restricting the trees to small sub-samples, the ensemble fails to capture the complete global manifold, resulting in a loss of structural information.
| Dataset | exact MST | Ensemble size = | ||||||
|---|---|---|---|---|---|---|---|---|
| 4 | 8 | 16 | 32 | 64 | 128 | 256 | ||
| Mean AUC scores across seeds | ||||||||
| annthyroid | 0.887 | 0.888 | 0.888 | 0.888 | 0.888 | 0.888 | 0.888 | 0.888 |
| magic.gamma | 0.693 | 0.695 | 0.694 | 0.694 | 0.695 | 0.695 | 0.695 | 0.695 |
| mammography | 0.836 | 0.858 | 0.859 | 0.859 | 0.859 | 0.859 | 0.859 | 0.859 |
| mnist | 0.845 | 0.840 | 0.840 | 0.840 | 0.840 | 0.840 | 0.840 | 0.840 |
| satellite | 0.692 | 0.678 | 0.677 | 0.677 | 0.677 | 0.677 | 0.677 | 0.677 |
| Standard deviation of AUC scores across seeds | ||||||||
| annthyroid | 0.000 | 0.004 | 0.002 | 0.002 | 0.001 | 0.001 | 0.001 | 0.001 |
| magic.gamma | 0.000 | 0.005 | 0.003 | 0.002 | 0.002 | 0.001 | 0.001 | 0.001 |
| mammography | 0.000 | 0.005 | 0.003 | 0.002 | 0.001 | 0.001 | 0.001 | 0.001 |
| mnist | 0.000 | 0.007 | 0.005 | 0.004 | 0.002 | 0.002 | 0.001 | 0.001 |
| satellite | 0.000 | 0.006 | 0.004 | 0.003 | 0.002 | 0.001 | 0.001 | 0.001 |
| Execution times [s] | ||||||||
| annthyroid | 0.461 | 0.007 | 0.015 | 0.027 | 0.051 | 0.097 | 0.196 | 0.385 |
| magic.gamma | 3.380 | 0.016 | 0.029 | 0.058 | 0.116 | 0.227 | 0.452 | 0.901 |
| mammography | 0.993 | 0.009 | 0.017 | 0.033 | 0.065 | 0.129 | 0.256 | 0.509 |
| mnist | 1.084 | 0.022 | 0.043 | 0.083 | 0.163 | 0.320 | 0.633 | 1.257 |
| satellite | 0.460 | 0.012 | 0.023 | 0.045 | 0.088 | 0.173 | 0.345 | 0.684 |
Table 3 The effect of different ensemble sizes
However, in the case of the mammography dataset, the ensemble method outperformed the exact baseline. Our investigations revealed that this dataset contains a relatively high number of coincident or near-coincident anomalous samples. These tightly packed micro-clusters trigger a masking effect: the exact MST algorithm perceives the near-zero distances between these identical or highly similar anomalies as evidence of a dense, normal region. The sub-sampling of the ensemble resolves this issue. By constructing trees from small random subsets, these dense anomaly clusters are broken apart, the anomalies lose their masking and are forced to connect to the tree via longer edges, making the anomalies easier to identify.
Next, we investigate the influence of the sub-sample size (the number of data samples per tree) while keeping the ensemble size fixed at 100, which aligns with the default parameter of the traditional Isolation Forest. As demonstrated in Table 4, this hyperparameter exhibits a more pronounced impact on the overall performance than the total number of trees. For the majority of the datasets, increasing the sub-sample size systematically improves the AUC scores. Interestingly, for certain datasets such as mammography, restricting the trees to a significantly smaller sample size yields better accuracy. As detailed earlier, this phenomenon follows from the masking effect: trees constructed from fewer samples can more effectively break apart relatively dense clusters of anomalies.
The standard deviations of the predictions are summarized in the middle part of Table 4. The results indicate a clear trend: as the number of instances per tree increases, the variance of the ensemble decreases.
| Dataset | exact MST | Number of samples per tree = | ||||||
|---|---|---|---|---|---|---|---|---|
| 4 | 8 | 16 | 32 | 64 | 128 | 256 | ||
| Mean AUC scores across seeds | ||||||||
| annthyroid | 0.887 | 0.865 | 0.875 | 0.881 | 0.885 | 0.887 | 0.888 | 0.888 |
| magic.gamma | 0.693 | 0.688 | 0.690 | 0.693 | 0.695 | 0.695 | 0.695 | 0.695 |
| mammography | 0.836 | 0.914 | 0.904 | 0.892 | 0.881 | 0.872 | 0.865 | 0.859 |
| mnist | 0.845 | 0.820 | 0.827 | 0.832 | 0.835 | 0.838 | 0.839 | 0.840 |
| satellite | 0.692 | 0.611 | 0.626 | 0.641 | 0.654 | 0.665 | 0.672 | 0.677 |
| Standard deviation of AUC scores across seeds | ||||||||
| annthyroid | 0.000 | 0.007 | 0.004 | 0.003 | 0.002 | 0.001 | 0.001 | 0.001 |
| magic.gamma | 0.000 | 0.007 | 0.005 | 0.004 | 0.003 | 0.002 | 0.001 | 0.001 |
| mammography | 0.000 | 0.003 | 0.003 | 0.003 | 0.002 | 0.002 | 0.001 | 0.001 |
| mnist | 0.000 | 0.013 | 0.008 | 0.005 | 0.004 | 0.003 | 0.002 | 0.001 |
| satellite | 0.000 | 0.009 | 0.006 | 0.004 | 0.003 | 0.003 | 0.002 | 0.001 |
| Execution times [s] | ||||||||
| annthyroid | 0.461 | 0.021 | 0.022 | 0.025 | 0.030 | 0.043 | 0.072 | 0.149 |
| magic.gamma | 3.380 | 0.034 | 0.038 | 0.046 | 0.063 | 0.097 | 0.172 | 0.349 |
| mammography | 0.993 | 0.025 | 0.027 | 0.031 | 0.039 | 0.057 | 0.098 | 0.196 |
| mnist | 1.084 | 0.024 | 0.030 | 0.042 | 0.071 | 0.129 | 0.230 | 0.486 |
| satellite | 0.460 | 0.020 | 0.023 | 0.029 | 0.040 | 0.071 | 0.131 | 0.269 |
Table 4 The effect of the number of samples per tree
Finally, we investigate the impact of the feature bagging ratio. As shown in the upper part of Table 5, this hyperparameter has a substantial effect on the overall performance. For datasets where every feature is informative and plays a crucial role in detecting anomalies (such as annthyroid, magic.gamma or satellite), it is optimal to set this parameter to a high value. Conversely, some datasets contain numerous uninformative features that act as noise and degrade the algorithm's detection capabilities. Feature bagging enables the generation of trees that incorporate fewer of these noisy dimensions. This is particularly evident with the mammography dataset, which achieved its highest score at a setting of 0.6, and the mnist dataset, which is better handled with a bagging ratio of 0.2. Furthermore, the table demonstrates that among all the hyper-parameters, the feature bagging ratio has the most pronounced effect on increasing the variance of the results.
5.3 Evaluation on the ADBench datasets
In this section, we evaluate the performance of our proposed method against several widely used anomaly detection algorithms. For this comparative analysis, we utilize the comprehensive collection of labeled benchmark datasets introduced in the ADBench study [27]. The anomaly detection methods involved in the comparison are PCA [14], OCSVM [15], KNN [16], LOF [17], CBLOF [18], HBOS [19], COPOD [20], ECOD [21], and IF [13]. Each method was executed 10 times using different random seeds and the final results were averaged. For the RIFT ensemble we used trees, samples per tree and no feature bagging (ratio 1.0), which are the default ensemble
| Dataset | exact MST | Feature bagging ratio = | ||||||
|---|---|---|---|---|---|---|---|---|
| 0.1 | 0.2 | 0.3 | 0.4 | 0.6 | 0.8 | 1.0 | ||
| Mean AUC scores across seeds | ||||||||
| annthyroid | 0.887 | 0.840 | 0.840 | 0.840 | 0.858 | 0.877 | 0.887 | 0.888 |
| magic.gamma | 0.693 | 0.687 | 0.689 | 0.690 | 0.692 | 0.693 | 0.694 | 0.695 |
| mammography | 0.836 | 0.848 | 0.848 | 0.848 | 0.860 | 0.867 | 0.840 | 0.859 |
| mnist | 0.845 | 0.744 | 0.843 | 0.840 | 0.840 | 0.840 | 0.840 | 0.840 |
| satellite | 0.692 | 0.675 | 0.675 | 0.675 | 0.676 | 0.676 | 0.677 | 0.677 |
| Standard deviation of AUC scores across seeds | ||||||||
| annthyroid | 0.000 | 0.025 | 0.025 | 0.025 | 0.022 | 0.016 | 0.010 | 0.001 |
| magic.gamma | 0.000 | 0.011 | 0.008 | 0.006 | 0.005 | 0.004 | 0.002 | 0.001 |
| mammography | 0.000 | 0.009 | 0.009 | 0.009 | 0.008 | 0.022 | 0.007 | 0.001 |
| mnist | 0.000 | 0.051 | 0.011 | 0.009 | 0.006 | 0.005 | 0.003 | 0.001 |
| satellite | 0.000 | 0.005 | 0.003 | 0.003 | 0.002 | 0.002 | 0.002 | 0.001 |
| Execution times [s] | ||||||||
| annthyroid | 0.461 | 0.128 | 0.127 | 0.125 | 0.129 | 0.131 | 0.139 | 0.150 |
| magic.gamma | 3.380 | 0.264 | 0.237 | 0.246 | 0.266 | 0.307 | 0.292 | 0.349 |
| mammography | 0.993 | 0.159 | 0.159 | 0.158 | 0.162 | 0.168 | 0.181 | 0.195 |
| mnist | 1.084 | 0.184 | 0.219 | 0.286 | 0.321 | 0.419 | 0.475 | 0.482 |
| satellite | 0.460 | 0.126 | 0.158 | 0.164 | 0.182 | 0.210 | 0.231 | 0.271 |
Table 5 The effect of feature bagging ratio
size and sub-sample size of the IF, so that the two ensembles are directly comparable. These values were fixed in advance and not tuned per dataset. The baseline methods were run with the default hyper-parameters of PyOD [28]. All methods received the same preprocessing (median/MAD scaling, described in Section 5).
Certain benchmark datasets are exceptionally large in terms of either sample size or dimensionality, preventing specific algorithms from completing execution within a reasonable timeframe. Consequently, for datasets exceeding 20,000 instances or 500 features, PCA, OCSVM, KNN, LOF, and the exact version of our proposed RIFT algorithm were omitted from the evaluation.
The detailed numerical results of the AUC comparison are summarized in Table 6.
As demonstrated by the ADBench study, it is impossible to declare a universal winner, no single anomaly detection method consistently outperforms the rest. The effectiveness of these algorithms is highly data-dependent, with certain methods excelling on specific datasets while struggling on others. This inherent variability underscores the need for developing algorithms based on novel theoretical paradigms, such as our proposed approach. The evaluation results across all datasets are summarized in Table 8, while Table 7 presents the performance metrics specifically for the smaller datasets.
On the smaller datasets, the IF (introduced in 2008) and all RIFT variants perform at essentially the same level, with the Isolation Forest holding a marginal lead (mean AUC of 0.7561 versus 0.7526 and 0.7518 for RIFT exact and RIFT ensemble). On the full collection, which also includes the large datasets where only the scalable methods could be run, the RIFT ensemble achieves the highest mean AUC, narrowly
| Dataset | PCA | OCSVM | KNN | LOF | CBLOF | HBOS | COPOD | ECOD | IF | LODA | Ensemble | RIFT Exact | KNN |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| ALOI | - | - | - | - | 0.557 | 0.529 | 0.515 | 0.531 | 0.539 | 0.497 | 0.558 | - | 0.558 |
| amyloid | 0.677 | 0.854 | 0.909 | 0.523 | 0.903 | 0.620 | 0.776 | 0.789 | 0.819 | 0.533 | 0.888 | 0.887 | 0.887 |
| backdoor | - | - | - | - | 0.789 | 0.739 | 0.789 | 0.846 | 0.740 | 0.682 | 0.848 | - | 0.833 |
| breastw | 0.946 | 0.917 | 0.977 | 0.385 | 0.965 | 0.985 | 0.994 | 0.991 | 0.987 | 0.988 | 0.971 | 0.962 | 0.962 |
| campaign | - | - | - | - | 0.771 | 0.773 | 0.783 | 0.770 | 0.713 | 0.564 | 0.796 | - | 0.801 |
| cardio | 0.951 | 0.887 | 0.692 | 0.562 | 0.814 | 0.841 | 0.922 | 0.935 | 0.931 | 0.847 | 0.892 | 0.895 | 0.895 |
| Cardiotocography | 0.752 | 0.756 | 0.512 | 0.552 | 0.572 | 0.599 | 0.663 | 0.785 | 0.682 | 0.708 | 0.758 | 0.766 | 0.766 |
| celeba | - | - | - | - | 0.645 | 0.755 | 0.751 | 0.757 | 0.694 | 0.548 | 0.725 | - | 0.671 |
| census | - | - | - | - | 0.695 | 0.620 | 0.674 | 0.660 | 0.608 | 0.485 | 0.648 | - | - |
| cover | - | - | - | - | 0.897 | 0.762 | 0.884 | 0.920 | 0.880 | 0.876 | 0.862 | - | 0.835 |
| donors | - | - | - | - | 0.682 | 0.736 | 0.815 | 0.888 | 0.776 | 0.533 | 0.724 | - | 0.779 |
| fault | 0.484 | 0.452 | 0.649 | 0.591 | 0.562 | 0.599 | 0.455 | 0.469 | 0.575 | 0.440 | 0.434 | 0.433 | 0.433 |
| fraud | - | - | - | - | 0.953 | 0.954 | 0.947 | 0.950 | 0.950 | 0.670 | 0.955 | - | 0.955 |
| glass | 0.709 | 0.866 | 0.887 | 0.809 | 0.868 | 0.780 | 0.755 | 0.705 | 0.786 | 0.575 | 0.831 | 0.831 | 0.831 |
| Hepatitis | 0.755 | 0.683 | 0.722 | 0.750 | 0.657 | 0.769 | 0.804 | 0.739 | 0.709 | 0.577 | 0.735 | 0.735 | 0.735 |
| http | - | - | - | - | 0.999 | 0.994 | 0.992 | 0.979 | 1.000 | 0.587 | 0.999 | - | 0.054 |
| InternetAds | - | - | - | - | 0.703 | 0.684 | 0.676 | 0.677 | 0.688 | 0.566 | 0.690 | - | 0.692 |
| Ionosphere | 0.788 | 0.911 | 0.929 | 0.893 | 0.892 | 0.542 | 0.789 | 0.728 | 0.848 | 0.817 | 0.847 | 0.846 | 0.846 |
| landsat | 0.365 | 0.359 | 0.578 | 0.550 | 0.576 | 0.555 | 0.421 | 0.368 | 0.484 | 0.385 | 0.443 | 0.461 | 0.461 |
| letter | 0.526 | 0.506 | 0.901 | 0.896 | 0.769 | 0.596 | 0.560 | 0.572 | 0.636 | 0.540 | 0.579 | 0.582 | 0.582 |
| Lymphography | 0.996 | 0.980 | 0.980 | 0.979 | 0.976 | 0.993 | 0.996 | 0.995 | 0.999 | 0.786 | 0.982 | 0.982 | 0.982 |
| magic.gamma | 0.673 | 0.682 | 0.792 | 0.696 | 0.700 | 0.716 | 0.681 | 0.638 | 0.723 | 0.652 | 0.695 | 0.693 | 0.693 |
| mammography | 0.888 | 0.888 | 0.873 | 0.722 | 0.858 | 0.801 | 0.905 | 0.906 | 0.858 | 0.873 | 0.859 | 0.836 | 0.836 |
| mnist | 0.851 | 0.815 | 0.796 | 0.646 | 0.793 | 0.618 | 0.774 | 0.746 | 0.797 | 0.730 | 0.840 | 0.845 | 0.845 |
| musk | 1.000 | 1.000 | 0.756 | 0.560 | 1.000 | 1.000 | 0.946 | 0.956 | 1.000 | 0.988 | 1.000 | 1.000 | 1.000 |
| optdigits | 0.521 | 0.563 | 0.419 | 0.586 | 0.804 | 0.846 | 0.682 | 0.605 | 0.722 | 0.499 | 0.600 | 0.600 | 0.600 |
| PageBlocks | 0.904 | 0.910 | 0.911 | 0.722 | 0.915 | 0.768 | 0.875 | 0.914 | 0.900 | 0.722 | 0.913 | 0.911 | 0.911 |
| pendigits | 0.934 | 0.943 | 0.761 | 0.516 | 0.911 | 0.924 | 0.905 | 0.927 | 0.942 | 0.936 | 0.954 | 0.958 | 0.958 |
| Pima | 0.637 | 0.620 | 0.702 | 0.629 | 0.646 | 0.706 | 0.654 | 0.594 | 0.673 | 0.637 | 0.674 | 0.674 | 0.674 |
| satellite | 0.602 | 0.606 | 0.655 | 0.545 | 0.728 | 0.756 | 0.633 | 0.583 | 0.705 | 0.620 | 0.677 | 0.692 | 0.692 |
| satimage-2 | 0.977 | 0.985 | 0.924 | 0.546 | 0.999 | 0.980 | 0.974 | 0.965 | 0.994 | 0.985 | 0.994 | 0.994 | 0.994 |
| shuttle | - | - | - | - | 0.764 | 0.984 | 0.995 | 0.993 | 0.997 | 0.567 | 0.994 | - | 0.994 |
| skin | - | - | - | - | 0.594 | 0.587 | 0.471 | 0.489 | 0.674 | 0.448 | 0.620 | - | 0.585 |
| smtp | - | - | - | - | 0.867 | 0.806 | 0.912 | 0.880 | 0.904 | 0.822 | 0.900 | - | 0.886 |
| SpamBase | 0.550 | 0.563 | 0.545 | 0.433 | 0.597 | 0.652 | 0.688 | 0.656 | 0.629 | 0.449 | 0.599 | 0.607 | 0.607 |
| speech | 0.469 | 0.466 | 0.484 | 0.508 | 0.468 | 0.476 | 0.491 | 0.470 | 0.473 | 0.462 | 0.470 | 0.469 | 0.469 |
| Stamps | 0.906 | 0.864 | 0.851 | 0.466 | 0.761 | 0.893 | 0.930 | 0.876 | 0.890 | 0.899 | 0.888 | 0.888 | 0.888 |
| thyroid | 0.958 | 0.989 | 0.982 | 0.561 | 0.984 | 0.941 | 0.939 | 0.977 | 0.979 | 0.869 | 0.989 | 0.989 | 0.989 |
| vertebral | 0.439 | 0.433 | 0.381 | 0.457 | 0.394 | 0.303 | 0.335 | 0.420 | 0.355 | 0.298 | 0.374 | 0.374 | 0.374 |
| vowels | 0.597 | 0.766 | 0.969 | 0.935 | 0.893 | 0.675 | 0.496 | 0.593 | 0.755 | 0.699 | 0.753 | 0.754 | 0.754 |
| Waveform | 0.647 | 0.595 | 0.740 | 0.711 | 0.728 | 0.690 | 0.734 | 0.603 | 0.720 | 0.615 | 0.724 | 0.725 | 0.725 |
| WBC | 0.993 | 0.995 | 0.992 | 0.805 | 0.980 | 0.989 | 0.995 | 0.995 | 0.995 | 0.990 | 0.995 | 0.995 | 0.995 |
| WDBC | 0.986 | 0.973 | 0.969 | 0.983 | 0.913 | 0.992 | 0.994 | 0.971 | 0.988 | 0.975 | 0.981 | 0.982 | 0.982 |
| Wilt | 0.378 | 0.478 | 0.689 | 0.665 | 0.553 | 0.350 | 0.345 | 0.394 | 0.462 | 0.354 | 0.485 | 0.485 | 0.485 |
| wine | 0.787 | 0.769 | 0.587 | 0.889 | 0.267 | 0.907 | 0.867 | 0.733 | 0.802 | 0.871 | 0.880 | 0.880 | 0.880 |
| WPBC | 0.481 | 0.470 | 0.501 | 0.504 | 0.471 | 0.554 | 0.523 | 0.481 | 0.498 | 0.500 | 0.477 | 0.477 | 0.477 |
| yeast | 0.397 | 0.408 | 0.401 | 0.464 | 0.450 | 0.402 | 0.381 | 0.444 | 0.397 | 0.461 | 0.379 | 0.381 | 0.381 |
Table 6 ROCAUC scores on the ADBench classic benchmark datasets
| IF | 0.7561 | 0.0220 |
|---|---|---|
| RIFT exact | 0.7526 | 0.0000 |
| RIFT KNN | 0.7526 | 0.0000 |
| RIFT ensemble | 0.7518 | 0.0010 |
| KNN | 0.7476 | 0.0000 |
| CBLOF | 0.7461 | 0.0384 |
| OCSVM | 0.7339 | 0.0000 |
| COPOD | 0.7319 | 0.0000 |
| HBOS | 0.7299 | 0.0000 |
| PCA | 0.7213 | 0.0000 |
| ECOD | 0.7213 | 0.0000 |
| LODA | 0.6847 | 0.0890 |
| LOF | 0.6481 | 0.0000 |
Table 7 Results for datasets with at most 20,000 samples and 500 features
| Mean AUC | Relative std of AUC | |
|---|---|---|
| RIFT ensemble | 0.7634 | 0.0014 |
| IF | 0.7632 | 0.0212 |
| CBLOF | 0.7507 | 0.0426 |
| COPOD | 0.7466 | 0.0000 |
| ECOD | 0.7418 | 0.0000 |
| HBOS | 0.7391 | 0.0000 |
| LODA | 0.6623 | 0.1196 |
Table 8 Results for all classic datasets of ADBench
ahead of the Isolation Forest (0.7634 versus 0.7632, they are statistically indistinguishable). RIFT KNN performs extremely close to the exact variant only, it is much faster. Alongside the average AUC scores, the tables also report the relative standard deviation, calculated by dividing the standard deviation of the results obtained across different random seeds by the mean. For deterministic methods, this value is naturally 0, so both RIFT Exact and RIFT KNN have 0 standard deviation. Notably, the relative standard deviation of the RIFT ensemble is an order of magnitude lower than that of the IF on both dataset collections (0.0010 versus 0.0220, and 0.0014 versus 0.0212), even though the ensemble size was identical in both cases.
Table 9 reports the execution times of all methods. As with the IF, the runtime of the RIFT ensemble depends strongly on the ensemble size and on the number of samples used per tree. We deliberately set both parameters to the defaults of the Isolation Forest, so that the two ensembles are directly comparable. Even so, the RIFT ensemble is slower than the IF, because building a single RIFT tree requires more computation than building an isolation tree. In exchange, each RIFT tree depends on fewer random choices, which explains why RIFT has a lower variance but a higher
| Dataset | PCA | OCSVM | KNN | LOF | CBLOF | HBOS | COPOD | ECOD | IF | LODA | Ensemble | RIFT Exact | KNN |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| ALOI | - | - | - | - | 0.144 | 0.099 | 0.322 | 0.919 | 0.218 | 0.086 | 1.394 | - | 3.796 |
| amnthyroid | 0.001 | 0.877 | 0.038 | 0.063 | 0.007 | 0.001 | 1.661 | 0.048 | 0.116 | 0.016 | 0.155 | 0.412 | 0.057 |
| backdoor | - | - | - | - | 0.530 | 0.187 | 4.068 | 2.027 | 0.441 | 0.664 | 7.669 | - | 53.208 |
| breastw | 0.001 | 0.008 | 0.012 | 0.013 | 0.002 | 0.001 | 0.788 | 0.011 | 0.080 | 0.005 | 0.069 | 0.003 | 0.006 |
| campaign | - | - | - | - | 0.071 | 0.040 | 0.259 | 1.104 | 0.314 | 0.142 | 1.775 | - | 4.627 |
| cardio | 0.001 | 0.079 | 0.010 | 0.011 | 0.003 | 0.002 | 0.014 | 0.013 | 0.085 | 0.007 | 0.108 | 0.030 | 0.012 |
| Cardiotocography | 0.002 | 0.101 | 0.012 | 0.013 | 0.004 | 0.002 | 0.014 | 0.014 | 0.087 | 0.008 | 0.112 | 0.039 | 0.016 |
| celeba | - | - | - | - | 0.277 | 0.138 | 0.496 | 0.487 | 1.320 | 0.630 | 6.494 | - | 44.168 |
| census | - | - | - | - | 5.477 | 1.596 | 16.994 | 16.845 | 1.366 | 4.738 | 50.150 | - | - |
| cover | - | - | - | - | 0.149 | 0.044 | 0.741 | 0.231 | 0.914 | 0.469 | 4.333 | - | 89.256 |
| donors | - | - | - | - | 0.227 | 0.127 | 0.643 | 0.645 | 3.229 | 1.348 | 9.205 | - | 2.412 |
| fault | 0.002 | 0.106 | 0.015 | 0.015 | 0.003 | 0.002 | 0.016 | 0.015 | 0.091 | 0.008 | 0.128 | 0.037 | 0.015 |
| fraud | - | - | - | - | 0.326 | 0.130 | 1.547 | 0.731 | 1.293 | 0.613 | 6.739 | - | 386.518 |
| glass | 0.001 | 0.001 | 0.012 | 0.012 | 0.001 | 0.001 | 1.288 | 0.011 | 0.074 | 0.004 | 0.046 | 0.001 | 0.005 |
| Hepatitis | 0.001 | 0.001 | 0.002 | 0.001 | 0.001 | 0.001 | 0.015 | 0.012 | 0.087 | 0.005 | 0.019 | 0.000 | 0.005 |
| http | - | - | - | - | 0.166 | 0.031 | 1.678 | 0.215 | 2.237 | 0.815 | 5.453 | - | 49.254 |
| InternetAds | - | - | - | - | 0.102 | 0.085 | 2.334 | 0.330 | 0.087 | 0.079 | 1.990 | - | 0.824 |
| Ionosphere | 0.001 | 0.005 | 0.002 | 0.002 | 0.002 | 0.002 | 0.012 | 0.012 | 0.080 | 0.005 | 0.087 | 0.001 | 0.005 |
| landsat | 0.006 | 1.352 | 0.106 | 0.104 | 0.011 | 0.006 | 0.023 | 0.023 | 0.112 | 0.020 | 0.282 | 0.461 | 0.085 |
| letter | 0.002 | 0.079 | 0.012 | 0.013 | 0.004 | 0.003 | 0.014 | 0.014 | 0.088 | 0.008 | 0.117 | 0.025 | 0.013 |
| Lymphography | 0.001 | 0.001 | 0.001 | 0.001 | 0.001 | 0.001 | 0.012 | 0.011 | 0.076 | 0.004 | 0.032 | 0.000 | 0.005 |
| magic.gamma | 0.003 | 7.633 | 0.171 | 0.268 | 0.012 | 0.004 | 0.532 | 0.022 | 0.186 | 0.040 | 0.376 | 3.322 | 0.364 |
| mammography | 0.002 | 2.183 | 0.091 | 0.102 | 0.008 | 0.002 | 1.588 | 0.053 | 0.134 | 0.023 | 0.203 | 0.981 | 0.067 |
| mnist | 0.045 | 4.835 | 0.414 | 0.393 | 0.046 | 0.014 | 2.127 | 0.065 | 0.130 | 0.037 | 0.518 | 1.076 | 0.313 |
| musk | 0.052 | 1.179 | 0.134 | 0.128 | 0.015 | 0.016 | 0.037 | 0.037 | 0.098 | 0.022 | 0.412 | 0.245 | 0.122 |
| optdigits | 0.013 | 1.441 | 0.151 | 0.144 | 0.015 | 0.009 | 0.031 | 0.031 | 0.113 | 0.023 | 0.291 | 0.380 | 0.111 |
| PageBlocks | 0.001 | 0.521 | 0.025 | 0.035 | 0.003 | 0.002 | 0.521 | 0.015 | 0.104 | 0.011 | 0.147 | 0.255 | 0.038 |
| pendigits | 0.002 | 1.012 | 0.073 | 0.054 | 0.006 | 0.003 | 0.019 | 0.017 | 0.125 | 0.021 | 0.191 | 0.452 | 0.063 |
| Pima | 0.001 | 0.010 | 0.013 | 0.013 | 0.002 | 0.001 | 1.858 | 0.012 | 0.081 | 0.005 | 0.069 | 0.004 | 0.007 |
| satellite | 0.006 | 1.380 | 0.120 | 0.105 | 0.012 | 0.006 | 0.026 | 0.024 | 0.111 | 0.021 | 0.282 | 0.460 | 0.086 |
| satimage-2 | 0.006 | 1.117 | 0.091 | 0.087 | 0.010 | 0.005 | 0.881 | 0.183 | 0.110 | 0.019 | 0.260 | 0.373 | 0.073 |
| shuttle | - | - | - | - | 0.019 | 0.008 | 0.807 | 0.046 | 0.321 | 0.072 | 0.796 | - | 2.356 |
| skin | - | - | - | - | 0.065 | 0.013 | 1.548 | 0.066 | 0.675 | 0.316 | 2.377 | - | 2.212 |
| smtp | - | - | - | - | 0.030 | 0.006 | 0.030 | 0.030 | 0.508 | 0.149 | 0.970 | - | 4.601 |
| SpanBase | 0.009 | 0.852 | 0.083 | 0.081 | 0.008 | 0.005 | 2.014 | 0.034 | 0.093 | 0.015 | 0.252 | 0.243 | 0.071 |
| speech | 0.880 | 4.656 | 0.634 | 0.610 | 0.086 | 0.042 | 0.107 | 0.106 | 0.102 | 0.047 | 0.825 | 0.676 | 0.248 |
| Stamps | 0.001 | 0.002 | 0.012 | 0.012 | 0.001 | 0.001 | 0.777 | 0.011 | 0.081 | 0.004 | 0.067 | 0.001 | 0.005 |
| thyroid | 0.001 | 0.227 | 0.023 | 0.027 | 0.003 | 0.001 | 1.560 | 0.049 | 0.098 | 0.010 | 0.108 | 0.115 | 0.023 |
| vertebral | 0.001 | 0.002 | 0.012 | 0.012 | 0.002 | 0.001 | 0.011 | 0.011 | 0.075 | 0.004 | 0.053 | 0.001 | 0.005 |
| vowels | 0.001 | 0.039 | 0.013 | 0.013 | 0.002 | 0.001 | 2.065 | 0.015 | 0.086 | 0.008 | 0.086 | 0.015 | 0.010 |
| Waveform | 0.002 | 0.272 | 0.025 | 0.029 | 0.006 | 0.002 | 0.015 | 0.015 | 0.098 | 0.013 | 0.140 | 0.112 | 0.031 |
| WBC | 0.001 | 0.001 | 0.012 | 0.012 | 0.001 | 0.001 | 0.770 | 0.011 | 0.076 | 0.004 | 0.047 | 0.001 | 0.005 |
| WDBC | 0.001 | 0.005 | 0.002 | 0.002 | 0.002 | 0.002 | 0.014 | 0.012 | 0.083 | 0.005 | 0.085 | 0.002 | 0.006 |
| Wilt | 0.001 | 0.352 | 0.016 | 0.025 | 0.004 | 0.001 | 1.537 | 0.058 | 0.103 | 0.011 | 0.113 | 0.182 | 0.030 |
| wine | 0.001 | 0.001 | 0.013 | 0.012 | 0.001 | 0.001 | 2.038 | 0.015 | 0.078 | 0.004 | 0.026 | 0.000 | 0.005 |
| WPBC | 0.001 | 0.002 | 0.001 | 0.001 | 0.001 | 0.002 | 0.012 | 0.011 | 0.078 | 0.004 | 0.052 | 0.001 | 0.005 |
| yeast | 0.001 | 0.035 | 0.013 | 0.013 | 0.003 | 0.001 | 1.032 | 0.012 | 0.083 | 0.007 | 0.077 | 0.015 | 0.010 |
Table 9 Runtime (seconds) on the ADBench classic benchmark datasets runtime. The slowdown is most pronounced on high-dimensional data, where computing Euclidean distances dominates the cost: on InternetAds, census and backdoor, the RIFT ensemble is 10–30 times slower than the IF, whereas on low-dimensional datasets such as http, smtp and skin the gap is only a factor of 2–4. The execution time can, however, be reduced substantially. As shown in Table 3, the number of trees can be decreased drastically with only a minimal loss in AUC, while the standard deviation stays low, reducing the ensemble size from 256 to 4 trees shortens the execution time by nearly two orders of magnitude. Sub-sampling (Table 4) and feature bagging (Table 5) provide further possibilities for reducing the computational cost.
6 Conclusions
In this paper we introduced an unsupervised, deep-learning-free anomaly detection method derived from the geometric interpretation of the recently established closed-form solution of the one-dimensional IF. By representing the data through its Euclidean Minimum Spanning Tree and scoring each point as the sum of the apparent sizes of the tree edges observed from it, this method generalizes the 1D result to arbitrary dimensions: in one dimension it recovers the exact expected output of an IF with infinitely many trees, while in higher dimensions it replaces the random recursive partitioning of IF with a deterministic, distance-based construction. The resulting score is inherently density-invariant and free of the axis-parallel artifacts characteristic of IF.
We presented three variants of the method: an exact formulation built on a global MST, a scalable approximation based on the k-nearest-neighbor graph, and a sub-sampled ensemble with feature bagging. The exact and approximate variants are fully deterministic, while the ensemble trades determinism for scalability and robustness, yet confines its randomness to the instance- and feature-sampling stage rather than to every split, as in IF.
On synthetic data and the ADBench benchmark suite, RIFT achieves accuracy competitive with IF. Consistent with the central observation of ADBench – that no single method dominates across all datasets – RIFT is not a universal winner, but it matches the strongest classical detectors while offering two distinct advantages: a fully deterministic variant, and an ensemble whose score variance across random seeds is an order of magnitude lower than that of IF at the same ensemble size.
Acknowledgement
The project supported by the Doctoral Excellence Fellowship Programme (DCEP) is funded by the National Research Development and Innovation Fund of the Ministry of Culture and Innovation and the Budapest University of Technology and Economics, under a grant agreement with the National Research, Development and Innovation Office.
References
[1] Chandola, V., Banerjee, A., Kumar, V.: Anomaly detection: A survey. ACM computing surveys (CSUR) 41(3), 1–58 (2009)
[2] Aggarwal, C.C.: Outlier Analysis, 2nd edn. Springer, Cham (2017)
[3] Hawkins, D.M.: Identification of Outliers vol. 11. Springer, Cham (1980)
[4] Hauskrecht, M., Batal, I., Valko, M., Visweswaran, S., Cooper, G.F., Clermont, G.: Outlier detection for patient monitoring and alerting. Journal of biomedical informatics 46(1), 47–55 (2013)
[5] Sommer, R., Paxson, V.: Outside the closed world: On using machine learning for network intrusion detection. In: 2010 IEEE Symposium on Security and Privacy, pp. 305–316 (2010). IEEE
[6] Fujimaki, R., Yairi, T., Machida, K.: An approach to spacecraft anomaly detection problem using kernel feature space. In: Proceedings of the Eleventh ACM SIGKDD International Conference on Knowledge Discovery in Data Mining, pp. 401–410 (2005)
[7] Gupta, M., Gao, J., Aggarwal, C.C., Han, J.: Outlier detection for temporal data: A survey. IEEE Transactions on Knowledge and Data Engineering 26(9), 2250–2267 (2013)
[8] Akoglu, L., Tong, H., Koutra, D.: Graph based anomaly detection and description: a survey. Data mining and knowledge discovery 29(3), 626–688 (2015)
[9] He, S., Zhu, J., He, P., Lyu, M.R.: Experience report: System log analysis for anomaly detection. In: 2016 IEEE 27th International Symposium on Software Reliability Engineering (ISSRE), pp. 207–218 (2016). IEEE
[10] Goldstein, M., Uchida, S.: A comparative evaluation of unsupervised anomaly detection algorithms for multivariate data. PloS one 11(4), 0152173 (2016)
[11] Emmott, A.F., Das, S., Dietterich, T., Fern, A., Wong, W.-K.: Systematic construction of anomaly detection benchmarks from real data. In: Proceedings of the ACM SIGKDD Workshop on Outlier Detection and Description, pp. 16–21 (2013)
[12] Pimentel, M.A., Clifton, D.A., Clifton, L., Tarassenko, L.: A review of novelty detection. Signal Processing 99, 215–249 (2014)
[13] Liu, F.T., Ting, K.M., Zhou, Z.: Isolation forest. In: 2008 Eighth IEEE International Conference on Data Mining (ICDM), pp. 413–422. IEEE, Pisa, Italy (2008). https://doi.org/10.1109/ICDM.2008.17
[14] Shyu, M.-L., Chen, S.-C., Sarinnapakorn, K., Chang, L.: A novel anomaly detection scheme based on principal component classifier. In: Proceedings of the IEEE Foundations and New Directions of Data Mining Workshop, pp. 172–179 (2003). IEEE Press Piscataway, NJ, USA
[15] Schölkopf, B., Williamson, R.C., Smola, A., Shawe-Taylor, J., Platt, J.: Support vector method for novelty detection. Advances in neural information processing systems 12 (1999)
[16] Ramaswamy, S., Rastogi, R., Shim, K.: Efficient algorithms for mining outliers from large data sets. In: Proceedings of the 2000 ACM SIGMOD International Conference on Management of Data, pp. 427–438 (2000)
[17] Breunig, M.M., Kriegel, H.-P., Ng, R.T., Sander, J.: Lof: identifying density-based local outliers. In: Proceedings of the 2000 ACM SIGMOD International Conference on Management of Data, pp. 93–104 (2000)
[18] He, Z., Xu, X., Deng, S.: Discovering cluster-based local outliers. Pattern recognition letters 24(9-10), 1641–1650 (2003)
[19] Goldstein, M., Dengel, A.: Histogram-based outlier score (hbos): A fast unsupervised anomaly detection algorithm. KI-2012: poster and demo track 1, 59–63 (2012)
[20] Li, Z., Zhao, Y., Botta, N., Ionescu, C., Hu, X.: Copod: copula-based outlier detection. In: 2020 IEEE International Conference on Data Mining (ICDM), pp. 1118–1123 (2020). IEEE
[21] Li, Z., Zhao, Y., Hu, X., Botta, N., Ionescu, C., Chen, G.H.: Ecod: Unsupervised outlier detection using empirical cumulative distribution functions. IEEE Transactions on Knowledge and Data Engineering 35(12), 12181–12193 (2022)
[22] Pevný, T.: Loda: Lightweight on-line detector of anomalies. Machine Learning 102(2), 275–304 (2016)
[23] Hariri, S., Kind, M.C., Brunner, R.J.: Extended isolation forest. IEEE Transactions on Knowledge and Data Engineering 33(4), 1479–1489 (2019)
[24] Hannák, G., Horváth, G., Kádár, A., Szalai, M.D.: Bilateral-weighted online adaptive isolation forest for anomaly detection in streaming data. Statistical Analysis and Data Mining: The ASA Data Science Journal 16(3), 215–223 (2023)
[25] Ding, Z., Fei, M.: An anomaly detection approach based on isolation forest algorithm for streaming data using sliding window. IFAC Proceedings Volumes 46(20), 12–17 (2013)
[26] Zheng, Q.-C., Zhang, S.-Q., Lyu, S.-H., Jiang, Y., Zhou, Z.-H.: Theoretical Investigation on Inductive Bias of Isolation Forest (2025). https://doi.org/10.48550/arXiv.2505.12825. https://arxiv.org/abs/2505.12825
[27] Han, S., Hu, X., Huang, H., Jiang, M., Zhao, Y.: Adbench: Anomaly detection benchmark. In: Neural Information Processing Systems (NeurIPS) (2022)

Fig. A1 Splitting between and
[28] Zhao, Y., Nasrullah, Z., Li, Z.: Pyod: A python toolbox for scalable outlier detection. Journal of Machine Learning Research 20(96), 1–7 (2019)
Appendix A The derivation of the explicit solution of the 1D Isolation Forest
In this section, we derive the expected path length of a training sample in an isolation tree. We assume that 1) the sample values are pairwise distinct and ordered as , 2) each tree is created on all samples ( ) without a height limit so that the recursion stops only when a node contains a single point, 3) at every node the split value is drawn uniformly from as in the original algorithm. We introduce as the limit of the forest-averaged path length as the number of trees tends to infinity. The same result is obtained in [26], our aim here is to show that it can also be derived in a few elementary algebraic steps.
We first express the expected path length of given a continuous subset of ordered data consisting of only elements with , that is, . From this quantity, we immediately get , since . By conditioning on the interval of the first random split, the expected path length of can be expressed recursively as
for , with the boundary condition . Here, the first term 1 is due to the split itself (increasing the path length by 1) and is the probability that the first split falls into the interval. If this interval is before , the problem can be reduced to finding the place of in the tree consisting of elements (represented by the second term of (A1)), if it is past , the problem can be reduced to the first part of the sequence (third term of (A1), see Figure A1).
The solution of the recursion is formulated by the following theorem.
Theorem 1 The expected path length of , , is given by the following explicit formula:
Proof First we show that for , defined by eq. (A1),
holds, which, since , proves the Theorem.
To show that (A3) satisfies (A1), we substitute (A3) into the right-hand side of (A1), leading to
Swapping the two sums in all four terms, we get
In all four terms, the inner sums collapse as and , yielding
(A6)
which, exploiting that the terms in parentheses are equal to and , gives
resulting (A3).