WorksComputer Science
Corrected mean depths and pairwise score fluctuations in isolation trees
Abstract
We study complete one-dimensional isolation trees trained on independent observations from a positive Lipschitz density on a compact interval. The mean held-out depth has additive constant in the interior and at or beyond an endpoint, correcting the asymptotes of Zheng et al. Inserting an interior query raises its mean by half a cut asymptotically. On two separated intervals the gap between components also contributes a finite depth term. For a reference pool of size , averaging all size- subsets and all cuts leaves variance of order for a fixed query and for the depth difference between two fixed distinct interior queries. When and , we obtain the leading variance constants from the effect of adding one point to a local Poisson process. Normalizing the depths suppresses absolute fluctuations, while the monotone isolation score retains the same pairwise ordering.
Introduction
Isolation forests score observations by how soon random cuts separate them from a training sample [6, 7]. Zheng et al. [13] derive exact finite-sample formulas for complete one-dimensional trees and identify separate density and position terms in the mean depth. We retain the nearest spacings when computing the additive constants.1 These spacings stay random on the scale of their denominators. In particular the two training depths bracketing an interior query can have a nonvanishing difference. Devroye [3]'s limit laws for insertion depths in split trees give a broader context for logarithmic growth. Mass estimation [11] uses random partitions to estimate probability content and provides a related approach to anomaly scoring. Our mean results concern a fixed query in a compact support model. Unbounded laws such as Gaussian or exponential distributions fall outside these assumptions.
Resampling without replacement is a standard form of aggregation [1, 2], and subsampled ensembles admit a -statistic representation [5, 8, 12, 10]. We study how a single observation near a query affects its score across training pools. This links the fluctuations of a pairwise difference to the order-one density and centrality terms that set its population scale.
Theorem 1 corrects the additive constants for held-out mean depths and gives the asymptotic half-cut effect of inserting an interior query.
Corollary 2 extends the mean calculation to two separated support intervals and identifies the contribution from the gap between them.
Theorem 3 proves a shared-pool variance rate of order for fixed queries and their pairwise contrasts. It gives explicit Poisson expressions for the leading constants when and .
Depth conventions and finite-sample identities
For a finite set of distinct real numbers, cut each nonsingleton node at a point uniform between its sample minimum and maximum, independently at successive nodes. Grow to singleton leaves and count cuts, with root depth zero. Let denote the depth of a query averaged over the cuts. These conventions agree with Algorithms 1 and 2 of Zheng et al. [13] in one dimension.
For an anchor , order the positive distances from to the points of on each side. The depth of is the sum of the two side contributions. For a distance list , the contribution is
An empty list contributes zero. If is between consecutive observations , its depth is
Queries beyond the sample range inherit the nearest extreme point’s depth. These identities are Theorems 3.5 and A.2 in Zheng et al. [13].
One derivation assigns each gap an independent exponential clock of rate equal to its length, along with an independent uniform cut location in the gap. This is the exponential-priority form of the interval-ancestor calculation for monotone random trees in Morales et al. [9]. At a node the first clock selects a gap with probability proportional to its length. Memorylessness gives the same cut law recursively. A gap to one side of a training point is cut on its path precisely when its clock precedes all clocks between that point and the gap’s far end. The probability is the gap length divided by that total distance, giving (1). The cut within the gap containing a held-out query determines the bracketing leaf reached, independently of the priority tree. This gives (2).
Let be iid with a density on which is Lipschitz there, with . Write for its cumulative distribution function and . For deterministic , write , , and . The inserted tree has other observations. Counterfactual insertion is also used in robust random cut forests [4].
Population mean depths
Theorem 1. Let be Euler’s constant and let all logarithms be natural. Under the assumptions of § 2, for fixed define
Then
For a fixed held-out query at or beyond a support endpoint, on its exterior side,
For every fixed interior query the right-minus-left bracketing training depth converges in distribution to a nondegenerate law common to these densities.
One-sided harmonic means
For uniform data on , the probability-scale query is denoted by . Let and $H_0 = 0.
Lemma 3.1. For iid uniform distances on , their ordered list satisfies and . The held-out uniform endpoint mean is exactly , with bounded fourth moments about .
For a sequence , the mean of the uniform inserted score at is
Its fourth moments about are bounded uniformly over queries in any compact interior interval.
Proof. The ordered distances have the joint law , where sums the first independent rate-one exponentials. The ratios for have independent laws. At each step beta–gamma independence gives independence of the latest ratio and the current total, and the earlier ratios are independent of that total and the next exponential by induction. The th summand has mean , with second and fourth raw moments and for ; the first summand is deterministic. The fourth central moment of the sum is bounded by the sum of the individual fourth central moments plus three times the square of the sum of their variances. Both sums are bounded by the displayed raw-moment series up to absolute factors.
Conditional on the training minimum, the remaining uniform points are iid above it. The first assertion gives the endpoint mean and moment bound there, and reflection handles the right endpoint. For an inserted query , the two side counts are and , with . Conditional side means are . For queries in a compact interior interval there exists such that except with uniformly exponentially small probability. On this event the harmonic expansion has uniform error , and the log terms are bounded. Because in probability, their expectations on the event differ from by . The complement contributes times its probability to the mean and times its probability to the fourth-moment bound. The same count argument gives this mean expansion for the sum of when the counts are positive.
The two bracketing depths
On the event of two uniform neighbors, let , and . Let list the distances from to the farther points on the left and the distances from to the farther points on the right. Define
Moving an anchor across the bracket gap changes the outward contribution from to . The gap itself contributes one at either anchor. Consequently the right-minus-left training depth is , and
Lemma 3.2. For a fixed , the uniform held-out depth has mean
The depth and each bracketing training depth on the two-sided event have bounded fourth moments about , uniformly on compact interior query intervals. The right-minus-left bracketing depth converges in law to the difference of two nondegenerate corrections which are iid conditional on their common limiting gap.
Proof. Given the counts , use independent rate-one exponential sequences for the uniform spacings on the two sides. Their totals are , ; the scale factors are and . The nearest spacings come from . The baselines in (6) have harmonic means and bounded centered fourth moments by the same ratio calculation as in Lemma 3.1, using the exponential sequences after . The tail of (5) after terms is bounded by . Indeed, bound each term by and sum the integral of from . For , on the count event and for large enough , let . Then
The first term has bounded fourth moment by the inverse fourth moment of Gamma, with the second parameter denoting rate. For the product in the second term, and independently. Their inverse and direct fourth moments are and , respectively. Reflection gives the other side’s bound. The first terms are bounded by and each entire correction is at most off the count event. Its probability is exponentially small. Equation (6) and the corresponding formulas for the two training depths now give the asserted fourth-moment bounds. A missing neighbor off the count event contributes at most times an exponentially small probability.
For the limit, couple across by partial sums of iid Bernoulli variables and use the same two exponential sequences for every . The laws of large numbers give and almost surely. Thus tend to independent rate-one exponentials, and each list converges term by term to independent rate-one Poisson arrival times, independent of the nearest spacings. The limiting bracket width has law Gamma. The tail estimate makes the error after terms tend to zero almost surely as , since the limiting arrival times diverge. The fourth-moment bound gives uniform integrability for the corrections and their products with the bounded interpolation weights.
If is the th outward Poisson arrival, then . For independent and , . For the mean correction is therefore
For the bracket , the limiting interpolation weights are independent of and the outward arrivals, since the ratio of one nearest exponential to their sum is uniform and independent of that sum. The mean offset from the harmonic baselines in (6) tends to , proving the expansion by Lemma 3.1. Conditional on , the two corrections are iid. With every later exponential spacing held fixed, increasing the first outward spacing strictly decreases the first summand in and decreases the remaining summands. Each conditional correction is therefore nondegenerate, as is their difference.
Transfer to physical coordinates
Lemma 3.3. For each side of any training or inserted anchor, the difference between the physical-coordinate side depth and its probability-coordinate counterpart is bounded by a constant depending only on the law and support length. For an iid sequence with dense sample and anchor tending to , if the side reaches endpoint , that difference tends almost surely to
For an interior query, the held-out and both bracketing depths have bounded fourth moments about , on the two-sided event for the bracketing depths. The held-out endpoint depth has bounded fourth moments about . The inserted fourth-moment bound is uniform on compact interior intervals, and along every deterministic its mean is .
Proof. On one side of an anchor , set and , with . The formula and give a uniform Lipschitz constant for . In a cell with near and far distances , the physical gap fraction minus the probability-scale gap fraction is
Its absolute value is bounded by a constant times . The first cell on each nonempty side contributes one on either scale. Summing proves the deterministic bound.
Let be the maximal spacing, including gaps to the support endpoints and the inserted anchor when present. The error from linearizing the exponential in (8) is bounded in sum by a constant times . In the linear term, replacing by costs from cells with . For the rest, , giving cost . The first cell can be included in the telescoping linear sum at cost . Since almost surely for an iid sample with full support, taking gives , where is the farthest distance on the side. As and the farthest point tends to , this is the claimed limit. The argument applies to deterministic moving anchors as well.
For each bracketing or inserted anchor tending to the same interior , the sum of the two side corrections tends to
A bounded correction may be passed through expectation. Both bracketing anchors acquire the same limiting correction, giving convergence of the physical bracket contrast to the same law as on the uniform scale. For interpolation, the physical weight in (2) differs from the probability-scale weight by at most a constant times the bracket width. This follows by writing the probability-scale weight as the physical subinterval fraction times the ratio of two averages of on subintervals of the bracket. The weight error tends to zero almost surely, is bounded, and multiplies a contrast with bounded second moment by Lemma 3.2. Cauchy–Schwarz shows the interpolation error tends to zero in expectation. For fourth moments use the deterministic bound on each anchor and convexity for the interpolation with physical weights. The exceptional one-sided event for an interior query has exponentially small probability and depths bounded by .
For an endpoint use the training extreme as anchor, so there is one side and the coordinate limit is . For a moving inserted query , apply Lemma 3.1 with . On the physical scale the deterministic bound and the dense-sample limit give expectation correction (9) at . The same correction evaluated at differs by by continuity. These bounds apply uniformly to the fourth moments over any compact interior interval, because both the coordinate bound and the harmonic count estimate are uniform there.
Proof of Theorem 1. Lemmas 3.1 and 3.2 give the uniform means and the bracket contrast. Lemma 3.3 passes them to physical coordinates. The probability-scale position term cancels in the interior. At or beyond an endpoint the clamping identity gives the same depth at every query on the corresponding exterior ray.
Comparison with Zheng et al.
Theorem 4.1 of Zheng et al. [13] gives the same density and position terms for a continuous distribution on a single bounded interval, and states sample-size and additive terms in the interior and elsewhere. For densities bounded away from zero and Lipschitz on the interval, our formulas decrease these constants by and .
In Appendix B.1 of Zheng et al. [13], equations (3)–(4) approximate the endpoint gap sum by an integral starting at the first sample spacing. For a uniform sample, conditional on the extremes, that spacing divided by the sample range has law for . The expected integral is . With the first gap’s unit contribution, the approximation gives , while Lemma 3.1 gives the exact . The discrepancy tends to one because the near-anchor denominators shrink with the mesh. For the interior, Appendix B.1 uses Lemma B.2 to discard the interpolation. That lemma bounds a reciprocal-square sum by an integral singular at the anchor. The nondegenerate limit in Theorem 1 contradicts the asserted almost-sure vanishing of the maximal adjacent contrast, since that maximum dominates the absolute contrast at any fixed interior query. The cancellation of the common interior constant preserves the mean-difference formula of their Corollary 4.2.
Supplement Table S1 compares the finite-sample means to both formulas. Its two interior designs suggest residuals of order , and its nonuniform endpoint is compatible with a correction. At the uniform endpoint the harmonic formula gives the exact leading residual .
| Interior queries: Uniform | Interior queries: | Left endpoints: Uniform | Left endpoints: | |
| 32 | 0.02372 (0.00075) | −0.01736 (0.00076) | −0.01571 | 0.23591 (0.00026) |
| 64 | 0.01384 (0.00040) | −0.01315 (0.00041) | −0.00783 | 0.15636 (0.00018) |
| 128 | 0.00734 (0.00023) | −0.00810 (0.00024) | −0.00391 | 0.09837 (0.00011) |
| 256 | 0.00357 (0.00015) | −0.00488 (0.00015) | −0.00195 | 0.05978 (0.00007) |
| 1024 | 0.00100 (0.00007) | −0.00125 (0.00007) | −0.00049 | 0.02024 (0.00002) |
| 4096 | 0.00027 (0.00003) | −0.00030 (0.00003) | −0.00012 | 0.00641 (0.00001) |
| Published | 2.5 | 2.5 | 1 | 1 |
Table S1. Estimated mean minus the corrected asymptote, in cuts. Parentheses give Monte Carlo standard errors. The last row shows the published asymptote on this same scale. The uniform endpoint entries are exact up to rounding.
Corollary 2 (Two separated intervals). Let the support be with and a positive Lipschitz density on each component. For a component , put
For , the held-out mean equals
At an endpoint of , its asymptotic expression is
Between and the asymptotic expression interpolates linearly between the two endpoint expressions, and outside it clamps to the corresponding outer endpoint.
Proof. Condition on the counts in the two components. For of mass the count is binomial with fraction converging to , and the conditional density is . Apply the one-component formulas to the interior query or the component’s relevant training extreme. The random count and conditional density combine to give at an edge and in the interior. Indeed the count divided by is bounded away from zero with exponentially high probability, so the log converges in expectation on that event and the deterministic depth bound controls its complement. On the same count event the centered extreme depths have bounded fourth moments by Lemma 3.3.
For an anchor tending to in the left component, let be the last point there and the first in the right component. The single gap contributes for anchor , tending to . Beyond , the sum is a right-endpoint Riemann sum with denominator bounded below by . It tends to . The added terms are bounded by the full range divided by , which permits taking expectations and preserves the extreme-depth moment bounds. Reflection gives the right-component expression. When the query is in a component interior its bracketing anchors lie in that component except on an exponentially small event. For any fixed , the same bracket the query and their interpolation weight tends to . The two depths have the common leading term and bounded centered second moments, so the replacement of the weights holds in expectation by Cauchy–Schwarz. Outside the total support clamping always applies, and an empty component has exponentially small probability.
In Corollary 4.3 of Zheng et al. [13], the two component interiors thus require both the shift and the separate gap fraction in . The outer edges require the shift and their corresponding gap fraction. At this fraction is one, canceling the one-sided shift of one cut. The correct gap-adjacent logarithmic terms are and , respectively. The printed expression at uses in the denominator.
Variance across reused reference pools
For this section the support is a single interval . Let be an iid reference pool. Define the complete subbagging score
This -statistic has mean , and its variance is over fresh pools. If two size- subsets are drawn independently conditional on the pool, the covariance of their cut-averaged depths equals , since the draws have common conditional mean . For an average of conditionally independent trees with both subset and cut randomness, the additional variance is , by total variance for a single tree depth . Here we study the pool term after taking both averages. Proposition 3.1 and Section 6.1 of Zheng et al. [13] consider tree averaging on a fixed dataset.
Rates and fixed-query comparisons
Let be the effective location, since all queries on a given exterior ray have the same depth as its endpoint. Define for and at an endpoint. The two positive constants are given by (14) below.
Theorem 3. Under the assumptions of Theorem 1, fix a query . For all and sufficiently large , , with positive comparison constants independent of . If and have distinct effective locations, then
Along and , the ratios of these variances to converge to and , respectively. In this regime the covariance of the two distinct effective query scores is . The variance constants are independent of and of the fixed location within each query type.
For either statistic, convergence in probability to its mean along holds exactly when . The same criterion holds with the corresponding asymptotic mean expression from Theorem 1, or its difference for two queries.
At , the two-query example in Supplement Table S2 has contrast variance 1.079 cuts squared, so its pool standard deviation is 1.04 cuts, comparable to the one-cut density contribution from a density ratio at equal centrality.
For two fixed interior queries the population depth difference converges to the difference of their log-density and log-centrality terms. When this limit is nonzero, suffices for the probability of a correct ordering to tend to one. If stays bounded away from zero, the random contrast around the population contrast has variance bounded away from zero. This describes the scale of ranking uncertainty and gives no reversal probability for an arbitrary fixed nonzero gap. For the score with the common positive normalizer in [6, 7], the centered normalized depth converges to zero in mean square by Theorem 3. For every the transformation is strictly decreasing, so ordering by increasing depth and by decreasing score gives the same pairwise comparison. The result concerns trees grown to singletons and fixed effective locations.
Local effect of forcing one observation
Let contain iid observations. For and put
Lemma 4.1. If , then has uniformly bounded fourth moments for in a fixed compact neighborhood of inside the support. For an endpoint , the fourth moments are bounded uniformly in . For each effective location there is a constant such that, for all and all ,
Proof. For any old training anchor, insertion within a gap whose near and far distances are changes its depth by
where is the distance to the inserted point. This is in ; if insertion extends the range, use . Thus on the event that brackets an interior , the centered fourth moments of all potential new bracketing anchors are bounded. For the old anchors this follows from Lemma 3.3 and the deterministic increment
bound. For the new anchor , use the inserted fourth-moment bound on the compact neighborhood in that lemma. Both the original and forced query depths are convex combinations of the corresponding anchor depths, or the inserted depth itself when . Their difference has bounded fourth moment by the triangle inequality in , with centering at , since is bounded. This also bounds the absolute contrast between any two eligible bracketing depths in the augmented tree. The one-sided event has exponentially small probability and depth bounded by .
At the score is the depth of the sample minimum . If , the old anchor increment is bounded by one. If , the new minimum has increment , where lists the distances from to the remaining old points. For the tail bound gives if there are at least terms, and otherwise. On transforming to the uniform scale, the ratio is bounded by times the corresponding uniform ratio. With normalized exponential spacings, that ratio is . Its fourth moment is finite. Reflection gives the same conclusion at .
For the envelope, let and first take . In the interior, with probability at least , an old training point on each side lies within of , for some . Indeed the intervals truncated to the support each have length at least a fixed positive multiple of , since and is fixed. At the left endpoint use the event , with the same exponential bound. On these events the anchors and weights stay the same after insertion, and each anchor lies at least to the left of . The increment at each anchor is bounded by , where is the distance back to the closest old observation to the left of , using if none exists. This follows from the increment formula and ; the preceding point is at or beyond each anchor. The tail of is bounded by over , so .
On the complementary event use Cauchy–Schwarz and the second moments just established when is near , and for all at the endpoint. For outside the interior neighborhood, is bounded below by a positive number, so the crude bound times is also exponentially small in , with a modified exponent. Reflection treats insertions to the left. Combining the bounds gives when . For the local moment bound suffices, enlarging the constant for finitely many small if needed. □
The limiting Poisson profiles
For a unit-rate Poisson process on the line, truncate it to a bounded window around zero, with depth zero for an empty window. Score the query zero before and after adding a point at . The limiting expected depth difference as the window expands is denoted by . For an endpoint, use a unit-rate process on the positive half-line and , with the query clamped to the first observation, to obtain . Then
Lemma 4.2 (Local Poisson limit). For fixed in the interior and , the limit defining exists and
At the same convergence holds to for ; at use .
Proof. On the probability scale the normalized exponential coupling of Lemma 3.2, used with points, gives almost-sure convergence of every fixed number of first arrivals on each side. The left and right limits are independent unit-rate Poisson processes. At the left endpoint use the single normalized exponential sequence starting at zero, and reflect at the right endpoint. The inverse distribution function gives the same limits for physical distances scaled by , since . In a fixed window the ordered configurations converge almost surely: the first limiting arrival outside each boundary rules out extra points, and a Poisson arrival lies on the boundary with probability zero. The truncated depth differences are continuous at these configurations almost surely, since the gaps are strictly positive and the forced point does not coincide with a Poisson observation.
To bound the terms discarded by truncation, fix and suppose the original scoring anchors are all in . After insertion the scoring anchors stay in that interval. Take and suppose there is a retained observation between and on each relevant side. A discarded gap on the right, including a gap crossing the truncation boundary, then has endpoints with . The contribution at an anchor differs from its value with denominator by at most
Summing over discarded gaps bounds the difference on that side by . On the left apply the same estimate after reflection. The discarded gaps are the same before and after insertion. Their reference contributions, with denominators given by the far-end distances to zero, cancel when subtracting the two depths, since the interpolation weights for each depth sum to one. Thus the error in a paired depth difference is at most for two sides, also valid on a half-line.
This bound applies to two nested truncations and to the full finite sample and its truncation. Almost surely a finite contains the original Poisson anchors, and all sufficiently large dyadic radii have observations in the required bands. For each such fixed radius the coupled finite configurations eventually retain their original anchors and have observations in the same bands. The bound also controls every larger radius between the dyadic radii. Taking the finite-sample limit in each fixed window and then increasing proves convergence of the full scaled depth difference to the limit of the Poisson truncations. Lemma 4.1 gives uniform integrability for the finite-sample depth differences.
For the Poisson expectations, once the original anchors are present, an insertion outside the interior bracket has a depth increment of at most one by the gap update. An insertion inside the bracket leaves the two outward baseline sums common to the old and new anchor depths. There are at most two unit contributions from gaps inside the bracket and at most two outward corrections of the form , each with shift no greater than the old width . Thus the paired difference is dominated by , where are the full outward arrival sequences. This bound is integrable by (7). On the half-line an insertion before the old minimum is bounded by , also integrable by (7). If a window omits an original anchor, its contribution to the expected absolute difference tends to zero by Cauchy–Schwarz: the missing-anchor probability is exponentially small in and the Poisson count plus one has second moment . These bounds justify taking the Poisson expectation in the limit.
Lemma 4.3 (Explicit profiles). For , define
and set . The endpoint profile is
The interior profile is even. For let be independent rate-one exponentials and . Its value is the expectation of
on , and of
on , with each contribution weighted by its event probability. The constants in (14) are finite and strictly positive.
Proof. For the rate-one outward arrivals , the th gap fraction conditional on has mean . Summing the gamma densities with weights gives , so . For numerical evaluation one can use
Both expressions vanish at zero. Differentiating the integral and integrating by parts gives the common derivative
At an endpoint the minimum is exponential. Given , the shift is rate-one exponential and independent of the process beyond , so the mean increment is by (7). If , the backward gap from is the smaller of and a rate-one exponential. Its mean is , and the independent forward gap is exponential. The gap update at has conditional mean , giving (16).
In the interior, reflection gives the claimed evenness. Given the two original neighbors, insertion at leaves both interpolation anchors unchanged. The backward gap has mean by the same truncated exponential calculation with as the leftmost point to the right of zero. The independent forward gap is exponential, so weighting the two anchor increments gives (17). If , the left anchor acquires by splitting the bracket gap, and the new anchor at has two first gaps of contribution one each. The outward baseline sums stay the same. The expected outward correction at the new anchor is in place of the old query’s expected correction . The new weight on the left anchor is , giving (18).
At zero, (7) gives . As , the term (17) is bounded by one on an event of vanishing probability, and (18) converges by domination by . Thus is continuous at zero. The endpoint profile is strictly positive for because for . Lemma 4.2 transfers the square-integrable envelope (13) to both profiles. This proves positivity and finiteness of both constants. □
Proof of Theorem 3. The first projection of the kernel at effective location is
The envelope (13) gives . In , change variables by writing , reflected at . The resulting density factor tends to one and is bounded. Lemma 4.2 and the square of (13) give dominated convergence. The squared centering term times vanishes, so
For distinct , split at the midpoint between them. On either piece at least one profile is uniformly. The bounds and the centering terms therefore give
The leading kernel projection for a contrast has variance constant .
For either kernel (one query or the contrast), let denote the variance of its order- canonical Hoeffding kernel [5]. Its full variance is , since the components are orthogonal by conditional centering in every argument. Counting how often a fixed -subset occurs in (10) gives its coefficient and the variance formula
Here tends to the positive constant just proved. Lemma 3.3 bounds uniformly, subtracting or at each effective location. The binomial ratio is at most , so the variance of the terms of order at least two is at most . These two facts give the upper and lower rates and the small-fraction limits. The covariance limit for distinct locations follows by the variance identity for the contrast.
Conditional Jensen bounds the fourth moment of the centered statistic by the fourth moment of its centered kernel. These moments are bounded by Lemma 3.3, also for the contrast. If , convergence to the mean follows from Chebyshev’s inequality. Otherwise a subsequence has variance bounded away from zero. Convergence in probability of the centered statistic to zero on that subsequence would force its variance to vanish by uniform integrability of the squares. Theorem 1 also gives vanishing errors in the asymptotic mean expressions. □
Discussion and limitations
Our results concern one-dimensional isolation trees grown to singleton leaves and evaluated at fixed queries. Standard iForest caps the tree height at for subsample size and adds to the traversed depth at a terminal node containing observations ([6 Algorithms 1–3]). Early stopping and the terminal adjustment change the depth kernel, so whether the mean corrections and variance rates persist for the adjusted path length is open. In multiple dimensions, a split on one feature changes the sample and spacings available for subsequent splits on other features. Extending the gap analysis to these trees, and measuring how finite forest size and pool reuse jointly affect rankings, are directions for further work.
Code and data availability
The simulation and quadrature code, run instructions, and checksums for the numerical reports are available at https://github.com/sehejjain/isolation-tree-bagging. All data are synthetic and generated by the code. The numerical results and Monte Carlo uncertainties appear in the supplement.
Convergence of the mean depths
Write for the corrected held-out mean asymptote in Theorem 1, including its logarithmic growth, density and position terms. Table S1 reports the residual from that asymptote for uniform and nonuniform designs on . The interior queries use the same probability coordinate . They are for the uniform law and for density . Both left-endpoint queries are .
Across to , the effective exponents for the absolute residuals are approximately 0.93 in the uniform interior, 1.01 in the nonuniform interior, and 0.81 at the nonuniform endpoint. At that nonuniform endpoint the product increases from 15.3 to 26.3 over this range, consistent with a logarithmic factor. These are finite-range empirical rates for the listed designs. At the uniform endpoint the harmonic expansion gives the exact leading error, .
For each size we use 32,768 iid replicates and average over cuts exactly. To resolve the smaller biases we compute the conditional harmonic baselines exactly and use paired differences for the gap corrections. In each two-sided uniform sample the finite and Poisson corrections share the exponential spacings before normalization. For the Poisson control we evaluate its first 24 outward terms and integrate the remaining tail. Given the last included outward coordinate and bracket width , the expected tail is , using from the main paper. Indeed, the future arrival at distance from has expected increment conditional on being the th future arrival. Summing those densities yields the integrand . The unconditional weighted Poisson correction is , independent of the two side counts used by the finite sample. For a one-sided uniform sample we use its exact conditional harmonic mean. For the nonuniform entries, we add the paired depth change under the physical quantile map, using the same samples as the corresponding uniform control and the same probability coordinate as the uniform query.
A separate simulation with support , weights 0.4, 0.6 and uniform component densities compares the two-support formula with cut-averaged means from 32,768 samples of size 2048. The seven query locations are 0, 0.3, 1, 2, 4, 5, 6, including both bracket endpoints and the gap interior. All seven estimates differ from the asymptotes by fewer than 0.0044 cuts. Their Monte Carlo standard errors range from 0.0025 to 0.0041 cuts.
We repeat the check with two nonuniform component densities, on and on . They have the same component masses and opposite slopes. Using 32,768 samples of size 4096, the residual of largest magnitude over the same seven queries is +0.0130 cuts at . Its Monte Carlo standard error is 0.0033 cuts, so this residual is about four standard errors from zero. Conditional on membership in the left component, the density is the same as in the nonuniform endpoint design of Table S1, with an expected component count of . Rescaling the single-interval residual at to that count using the suggested behavior gives about 0.014 cuts, a plausible scale for the finite-sample bias. Across the seven queries, the Monte Carlo standard errors range from 0.0025 to 0.0041 cuts. At the gap query , the residual is −0.0027 cuts with standard error 0.0025.
Variance constants and shared-pool checks
Numerical quadrature of the squared Poisson profiles gives and . The corresponding constant for a contrast between two distinct interior queries is about 0.9096. The integrals use Gauss–Laguerre rules of orders 96 and 192 for the exponential expectations and adaptive quadrature for the remaining integrals. Exponentially weighted regions beyond an exponential coordinate of 40 are omitted. The two evaluations of differ by about . Direct paired Monte Carlo estimates of each profile at , using the first 128 Poisson arrivals on each relevant side, check the conditional-increment formulas numerically. The eight estimates are within 0.009 cuts of the limiting profiles, with Monte Carlo standard errors from 0.0004 to 0.0038 cuts. A finite number of arrivals also introduces truncation error.
For each row of Table S2, we generate 32,768 independent pairs of bags using the exact hypergeometric distribution of their overlap. Conditional on that count, the overlap and the two sets of exclusive observations are independent draws. Within each bag the two queries used in the contrast share the same observations. The sample covariance of the two bag scores estimates the complete subbagging variance, by conditioning on the common pool. The scaling also multiplies the Monte Carlo errors.
| Interior | Endpoint | Contrast 0.3 vs. 0.7 | |
| 256 | 0.5237 (0.0041) | 0.3509 (0.0027) | 1.0790 (0.0085) |
| 1024 | 0.4416 (0.0122) | 0.1547 (0.0078) | 0.8876 (0.0245) |
| 4096 | 0.4103 (0.0476) | 0.1768 (0.0307) | 0.8607 (0.0958) |
| Small-fraction limit | 0.4548 | 0.1526 | 0.9096 |
Table S2. Shared-pool estimates of for , . Parentheses give Monte Carlo standard errors. For each statistic is its original single-bag kernel, averaged over cuts.
Direct finite-bag projection
The shared-pool covariance in Table S2 has a standard error of about 0.05 for the interior query at . To check the leading constants more precisely, we evaluate the finite-sample influence directly by paired insertion for on , at and . At each forced location , the depths with and without the forced point share the same observations. The integration coordinate gives , so the raw target is . The centered target is the scaled first-projection variance in Theorem 3.
We use two independent groups of 1024 bags per block and share each group’s bags over the grid. The product of the two mean profiles estimates at each location without the bias of squaring a noisy mean. For the centered estimate, subtract the product of the two integrated mean profiles divided by . We average over 48 independent blocks and compute standard errors across blocks. Composite Simpson quadrature covers the entire support in the coordinate, using spacing out to and eight subintervals per dyadic band in the tails. Comparing to the grid with every other point removed checks sensitivity to spacing.
| Interior | Endpoint | |||
| Raw | Centered | Raw | Centered | |
| 256 | 0.4566 (0.0014) | 0.4407 (0.0014) | 0.1492 (0.0014) | 0.1455 (0.0014) |
| 1024 | 0.4562 (0.0016) | 0.4522 (0.0016) | 0.1525 (0.0016) | 0.1516 (0.0016) |
| 4096 | 0.4551 (0.0013) | 0.4541 (0.0013) | 0.1545 (0.0017) | 0.1543 (0.0016) |
| Poisson limit | 0.4548 | 0.4548 | 0.1526 | 0.1526 |
Table S3. Direct finite-bag estimates of (raw) and (centered). Parentheses give Monte Carlo standard errors.
At , the relative Monte Carlo standard errors of the centered estimates are 0.29% and 1.07%, respectively. The largest absolute fine-to-coarse change in the raw estimates is 0.00042. Both centered estimates at lie within two Monte Carlo standard errors of their Poisson limits.
Finite formulas and original replay controls
Two implementations compare the finite depth formula with direct recursive integration over uniformly chosen cuts in rational arithmetic. All 3,451 cases agree. These cases cover each subset of sizes two through six of and half-unit queries from through 13. The implementations also check the harmonic endpoint and the limiting mean bracket correction.
The original population simulations use the uniform density and on , bag sizes 128, 512, 2048, and 8,192 replicates per size and density. At the maximum absolute error from the corrected mean across the query grid is 0.02650 cuts when sorting observations and 0.00821 cuts with the independent exponential-spacing implementation. The estimated mean insertion shifts at the interior queries lie between 0.49386 and 0.50207. The mean absolute uniform bracket contrast at is 0.5690 and 0.5817 in the two implementations. At , forcing an observation at or at raises the mean at either location. The shifts are about 0.493 cuts in the first implementation and 0.495 in the second.
Each shared-pool covariance in Table S4 uses 16,384 pairs of bag scores. Independent-pool control covariances are within 0.0031 of zero in all cases. The code and report checksums accompany this supplement.
| Direct pool sampling | Hypergeometric overlap | |
| 128 | 0.5049 (0.0056) | 0.5194 (0.0058) |
| 256 | 0.2211 (0.0044) | 0.2243 (0.0045) |
| 1024 | 0.0525 (0.0040) | 0.0520 (0.0041) |
Table S4. Original covariance checks for and uniform . The row estimates , since both bags are the full pool. Parentheses give Monte Carlo standard errors.
References
- [1]Peter Bühlmann and Bin Yu. Analyzing bagging. The Annals of Statistics, 30:927–961, 2002. URL https://doi.org/10.1214/aos/1031689014.
- [2]Andreas Buja and Werner Stuetzle. Observations on bagging. Statistica Sinica, 16:323–351, 2006. URL https://www3.stat.sinica.edu.tw/statistica/j16n2/j16n21/j16n21.html.
- [3]Luc Devroye. Universal limit laws for depths in random trees. SIAM Journal on Computing, 28:409–432, 1998. URL https://doi.org/10.1137/S0097539795283954.
- [4]Sudipto Guha, Nina Mishra, Gourav Roy, and Okke Schrijvers. Robust random cut forest based anomaly detection on streams. In Proceedings of the 33rd International Conference on Machine Learning, volume 48 of Proceedings of Machine Learning Research, pp. 2712–2721, 2016. URL https://proceedings.mlr.press/v48/guha16.html.
- [5]Wassily Hoeffding. A class of statistics with asymptotically normal distribution. The Annals of Mathematical Statistics, 19:293–325, 1948. URL https://doi.org/10.1214/aoms/1177730196.
- [6]Fei Tony Liu, Kai Ming Ting, and Zhi-Hua Zhou. Isolation forest. In Proceedings of the 8th IEEE International Conference on Data Mining, pp. 413–422, 2008. URL https://doi.org/10.1109/ICDM.2008.17.
- [7]Fei Tony Liu, Kai Ming Ting, and Zhi-Hua Zhou. Isolation-based anomaly detection. ACM Transactions on Knowledge Discovery from Data, 6:3, 2012. URL https://doi.org/10.1145/2133360.2133363.
- [8]Lucas Mentch and Giles Hooker. Quantifying uncertainty in random forests via confidence intervals and hypothesis tests. Journal of Machine Learning Research, 17(26):1–41, 2016. URL https://www.jmlr.org/papers/v17/14-168.html.
- [9]Fernando A. Morales, Jorge M. Ramírez, and Edgar A. Ramos. A mathematical assessment of the isolation random forest method for anomaly detection in big data. Mathematical Methods in the Applied Sciences, 46(1):1156–1177, 2023. URL https://doi.org/10.1002/mma.8570.
- [10]Wei Peng, Tim Coleman, and Lucas Mentch. Rates of convergence for random forests via generalized U-statistics. Electronic Journal of Statistics, 16:232–292, 2022. URL https://doi.org/10.1214/21-EJS1958.
- [11]Kai Ming Ting, Guang-Tong Zhou, Fei Tony Liu, and Swee Chuan Tan. Mass estimation. Machine Learning, 90:127–160, 2013. URL https://doi.org/10.1007/s10994-012-5303-x.
- [12]Stefan Wager and Susan Athey. Estimation and inference of heterogeneous treatment effects using random forests. Journal of the American Statistical Association, 113:1228–1242, 2018. URL https://doi.org/10.1080/01621459.2017.1319839.
- [13]Qin-Cheng Zheng, Shao-Qun Zhang, Shen-Huan Lyu, Yuan Jiang, and Zhi-Hua Zhou. Theoretical investigation on inductive bias of isolation forest. In Proceedings of the 43rd International Conference on Machine Learning, volume 306 of Proceedings of Machine Learning Research, pp. 163944–163972, 2026. URL https://proceedings.mlr.press/v306/zheng26ag.html.arxiv.org/abs/2505.12825
Machine contribution statement
No AI-use declaration is available for this version in Valency.
The available record does not establish whether AI systems or models contributed to this work.