Skip to content

Menu

WorksComputer Science

Corrected mean depths and pairwise score fluctuations in isolation trees

Download PDFView on arXiv

Ask your agent about this work

Your agent reads this work through Valency, with its citations and similar works. Paste this at the start of a chat.

Use the Valency MCP. Work: W_gqxr339f. Fetch it with get_paper_by_id, then find its nearest works with find_similar_papers and tell me what it adds.

Works with any MCP client. Not connected yet? Connect your agent

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 2γ−1/22γ-1/2 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 NN, averaging all size-mm subsets and all cuts leaves variance of order m/Nm/N for a fixed query and for the depth difference between two fixed distinct interior queries. When m/N→0m/N\to0 and m→∞m\to\infty, 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 UU-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 m/Nm/N for fixed queries and their pairwise contrasts. It gives explicit Poisson expressions for the leading constants when m→∞m \to\infty and m/N→0m/N \to0.

Depth conventions and finite-sample identities

For a finite set SS 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 D(x;S)D(x; S) denote the depth of a query xx averaged over the cuts. These conventions agree with Algorithms 1 and 2 of Zheng et al. [13] in one dimension.

For an anchor z∈Sz \in S, order the positive distances from zz to the points of SS on each side. The depth of zz is the sum of the two side contributions. For a distance list d=(d1,…,dk)d = (d_1, \ldots, d_k), the contribution is

L(d)=∑j=1kdj−dj−1dj,d0=0.(1)L(d) = \sum_{j=1}^{k} \frac{d_j-d_{j-1}}{d_j}, \qquad d_0=0. \tag*{(1)}

An empty list contributes zero. If xx is between consecutive observations z−<z+z_- < z_+, its depth is

D(x;S)=λD(z−;S)+(1−λ)D(z+;S),λ=z+−xz+−z−.(2)D(x; S) = \lambda D(z_-; S) + (1-\lambda)D(z_+; S), \qquad\lambda= \frac{z_+-x}{z_+-z_-}. \tag*{(2)}

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 X1,X2,…X_1, X_2, \ldots be iid with a density ff on [a,b][a,b] which is Lipschitz there, with 0<fmin⁡≤f≤fmax⁡<∞0 < f_{\min} \le f \le f_{\max} < \infty. Write FF for its cumulative distribution function and Sm={X1,…,Xm}S_m = \{X_1,\ldots,X_m\}. For deterministic xx, write Dm(x)=D(x;Sm)D_m(x) = D(x; S_m), μm(x)=EDm(x)\mu_m(x) = \mathbb{E}D_m(x), and Dmins(x)=D(x;Sm∪{x})D_m^{\mathrm{ins}}(x) = D(x; S_m \cup\{x\}). The inserted tree has mm other observations. Counterfactual insertion is also used in robust random cut forests [4].

Population mean depths

Theorem 1. Let γ\gamma be Euler’s constant and let all logarithms be natural. Under the assumptions of § 2, for fixed x∈(a,b)x \in(a,b) define

Mm(x)=2log⁡m+2γ−12+log⁡(f(x)2(x−a)(b−x)).M_m(x) = 2\log m + 2\gamma- \frac{1}{2} + \log\left(f(x)^2(x-a)(b-x)\right).

Then

μm(x)=Mm(x)+o(1),EDmins(x)=Mm(x)+12+o(1).(3)\mu_m(x) = M_m(x) + o(1), \qquad\mathbb{E}D_m^{\mathrm{ins}}(x) = M_m(x) + \frac{1}{2} + o(1). \tag*{(3)}

For a fixed held-out query at or beyond a support endpoint, on its exterior side,

μm(x)=log⁡m+γ+log⁡(f(e)(b−a))+o(1).(4)\mu_m(x) = \log m + \gamma+ \log\left(f(e)(b-a)\right) + o(1). \tag*{(4)}

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 [0,1][0,1], the probability-scale query is denoted by pp. Let Hk=∑j=1k1/jH_k = \sum_{j=1}^{k} 1/j and $H_0 = 0.

Lemma 3.1. For kk iid uniform distances on [0,ℓ][0,\ell], their ordered list dd satisfies EL(d)=Hk\mathbb{E}\mathcal{L}(d)=H_k and sup⁡kE∣L(d)−Hk∣4<∞\sup_k\mathbb{E}|\mathcal{L}(d)-H_k|^4<\infty. The held-out uniform endpoint mean is exactly Hm−1H_{m-1}, with bounded fourth moments about log⁡m\log m.

For a sequence pm→p∈(0,1)p_m\to p\in(0,1), the mean of the uniform inserted score at pmp_m is

2log⁡m+2γ+log⁡(pm(1−pm))+o(1).2\log m+2\gamma+\log(p_m(1-p_m))+o(1).

Its fourth moments about 2log⁡m2\log m are bounded uniformly over queries in any compact interior interval.

Proof. The ordered distances have the joint law ℓGj/Gk+1\ell G_j/G_{k+1}, where GjG_j sums the first jj independent rate-one exponentials. The ratios Gj−1/GjG_{j-1}/G_j for j≥2j\ge2 have independent Beta⁡(j−1,1)\operatorname{Beta}(j-1,1) 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 jjth summand has mean 1/j1/j, with second and fourth raw moments 2/[j(j+1)]2/[j(j+1)] and 24/[j(j+1)(j+2)(j+3)]24/[j(j+1)(j+2)(j+3)] for j≥2j\ge2; 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 m−1m-1 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 pmp_m, the two side counts are KK and m−Km-K, with K∼Bin⁡(m,pm)K\sim\operatorname{Bin}(m,p_m). Conditional side means are HK,Hm−KH_K,H_{m-K}. For queries in a compact interior interval there exists ϵ>0\epsilon>0 such that K,m−K≥ϵmK,m-K\ge\epsilon m except with uniformly exponentially small probability. On this event the harmonic expansion has uniform error O(1/m)O(1/m), and the log terms log⁡(K/m),log⁡(1−K/m)\log(K/m),\log(1-K/m) are bounded. Because K/m−pm→0K/m-p_m\to0 in probability, their expectations on the event differ from log⁡pm,log⁡(1−pm)\log p_m,\log(1-p_m) by o(1)o(1). The complement contributes O(m)O(m) times its probability to the mean and O(m4)O(m^4) times its probability to the fourth-moment bound. The same count argument gives this mean expansion for the sum of HK−1,Hm−K−1H_{K-1},H_{m-K-1} when the counts are positive.

The two bracketing depths

On the event of two uniform neighbors, let A−=p−z−A_-=p-z_-, A+=z+−pA_+=z_+-p and g=A−+A+g=A_-+A_+. Let V−V^- list the distances from z−z_- to the farther points on the left and V+V^+ the distances from z+z_+ to the farther points on the right. Define

Q(V,g)=∑j=1∣V∣Vj−Vj−1Vjgg+Vj,V0=0.(5)Q(V,g)=\sum_{j=1}^{|V|}\frac{V_j-V_{j-1}}{V_j}\frac{g}{g+V_j},\qquad V_0=0. \tag*{(5)}

Moving an anchor across the bracket gap changes the outward contribution from L(V)\mathcal{L}(V) to L(V)−Q(V,g)\mathcal{L}(V)-Q(V,g). The gap itself contributes one at either anchor. Consequently the right-minus-left training depth is Q(V+,g)−Q(V−,g)Q(V^+,g)-Q(V^-,g), and

Dm(p)=L(V−)+L(V+)+1−A+gQ(V+,g)−A−gQ(V−,g).(6)D_m(p)=\mathcal{L}(V^-)+\mathcal{L}(V^+)+1-\frac{A_+}{g}Q(V^+,g)-\frac{A_-}{g}Q(V^-,g). \tag*{(6)}

Lemma 3.2. For a fixed p∈(0,1)p\in(0,1), the uniform held-out depth has mean

2log⁡m+2γ−12+log⁡(p(1−p))+o(1).2\log m+2\gamma-\frac{1}{2}+\log(p(1-p))+o(1).

The depth and each bracketing training depth on the two-sided event have bounded fourth moments about 2log⁡m2\log m, 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 k,l=m−kk,l=m-k, use independent rate-one exponential sequences Ei−,Ei+E_i^-,E_i^+ for the uniform spacings on the two sides. Their totals are T−=∑i=1k+1Ei−T_-=\sum_{i=1}^{k+1}E_i^-, T+=∑i=1l+1Ei+T_+=\sum_{i=1}^{l+1}E_i^+; the scale factors are p/T−p/T_- and (1−p)/T+(1-p)/T_+. The nearest spacings come from E1−,E1+E_1^-,E_1^+. The baselines in (6) have harmonic means Hk−1,Hl−1H_{k-1},H_{l-1} and bounded centered fourth moments by the same ratio calculation as in Lemma 3.1, using the exponential sequences after E1±E_1^\pm. The tail of (5) after JJ terms is bounded by g/VJg/V_J. Indeed, bound each term by g(Vj−Vj−1)/Vj2g(V_j-V_{j-1})/V_j^2 and sum the integral of g/v2g/v^2 from VJV_J. For J=8J=8, on the count event k,l≥ϵmk,l\ge\epsilon m and for large enough mm, let PJ=∑i=2J+1Ei−P_J=\sum_{i=2}^{J+1}E_i^-. Then

gVJ=E1−PJ+1−ppT−PJE1+T+.\frac{g}{V_J}=\frac{E_1^-}{P_J}+\frac{1-p}{p}\frac{T_-}{P_J}\frac{E_1^+}{T_+}.

The first term has bounded fourth moment by the inverse fourth moment of Gamma(8,1)(8,1), with the second parameter denoting rate. For the product in the second term, PJ/T−∼Beta⁡(J,k+1−J)P_J/T_-\sim\operatorname{Beta}(J,k+1-J) and E1+/T+∼Beta⁡(1,l)E_1^+/T_+\sim\operatorname{Beta}(1,l) independently. Their inverse and direct fourth moments are O(k4)O(k^4) and O(l−4)O(l^{-4}), respectively. Reflection gives the other side’s bound. The first JJ terms are bounded by JJ and each entire correction is at most mm 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 O(m4)O(m^4) times an exponentially small probability.

For the limit, couple KK across mm by partial sums of iid Bernoulli variables and use the same two exponential sequences for every mm. The laws of large numbers give K/m→pK/m\to p and T−/K,T+/(m−K)→1T_-/K,T_+/(m-K)\to1 almost surely. Thus mA−,mA+mA_-,mA_+ tend to independent rate-one exponentials, and each list mV±mV^\pm converges term by term to independent rate-one Poisson arrival times, independent of the nearest spacings. The limiting bracket width GG has law Gamma(2,1)(2,1). The tail estimate makes the error after JJ terms tend to zero almost surely as J→∞J\to\infty, 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 τj\tau_j is the jjth outward Poisson arrival, then E[(τj−τj−1)/τj∣τj]=1/j\mathbb{E}[(\tau_j-\tau_{j-1})/\tau_j\mid\tau_j]=1/j. For independent G∼Gamma⁡(k,1)G\sim\operatorname{Gamma}(k,1) and τj∼Gamma⁡(j,1)\tau_j\sim\operatorname{Gamma}(j,1), E[G/(G+τj)]=k/(j+k)\mathbb{E}[G/(G+\tau_j)]=k/(j+k). For k=1,2k=1,2 the mean correction is therefore

EQ(τ,G)=∑j≥1kj(j+k)=Hk.(7)\mathbb{E}Q(\tau,G)=\sum_{j\ge1}\frac{k}{j(j+k)}=H_k. \tag*{(7)}

For the bracket k=2k=2, the limiting interpolation weights are independent of GG 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 1−H2=−1/21-H_2=-1/2, proving the expansion by Lemma 3.1. Conditional on GG, the two corrections are iid. With every later exponential spacing held fixed, increasing the first outward spacing strictly decreases the first summand in QQ 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 zz, if the side reaches endpoint e≠ze\ne z, that difference tends almost surely to

log⁡f(z)∣e−z∣∣F(e)−F(z)∣.\log\frac{f(z)|e-z|}{|F(e)-F(z)|}.

For an interior query, the held-out and both bracketing depths have bounded fourth moments about 2log⁡m2\log m, on the two-sided event for the bracketing depths. The held-out endpoint depth has bounded fourth moments about log⁡m\log m. The inserted fourth-moment bound is uniform on compact interior intervals, and along every deterministic xm→x∈(a,b)x_m\to x\in(a,b) its mean is Mm(xm)+12+o(1)M_m(x_m)+\frac{1}{2}+o(1).

Proof. On one side of an anchor z′z', set w(s)=∣F(z′±s)−F(z′)∣w(s)=|F(z'\pm s)-F(z')| and ϕ(s)=log⁡(w(s)/s)\phi(s)=\log(w(s)/s), with ϕ(0)=log⁡f(z′)\phi(0)=\log f(z'). The formula w(s)/s=∫01f(z′±su) duw(s)/s=\int_0^1 f(z'\pm su)\,du and fmin⁡>0f_{\min}>0 give a uniform Lipschitz constant for ϕ\phi. In a cell with near and far distances 0<l<r0<l<r, the physical gap fraction minus the probability-scale gap fraction is

w(l)w(r)[1−exp⁡(ϕ(r)−ϕ(l))].(8)\frac{w(l)}{w(r)}\left[1-\exp\bigl(\phi(r)-\phi(l)\bigr)\right]. \tag*{(8)}

Its absolute value is bounded by a constant times r−lr-l. The first cell on each nonempty side contributes one on either scale. Summing proves the deterministic bound.

Let hmax⁡h_{\max} 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 ∑(r−l)2=O(hmax⁡)\sum(r-l)^2 = O(h_{\max}). In the linear term, replacing w(l)/w(r)w(l)/w(r) by 11 costs O(ϵ+hmax⁡)O(\epsilon+h_{\max}) from cells with l<ϵl<\epsilon. For the rest, 1−w(l)/w(r)≤(fmax⁡/fmin⁡)hmax⁡/ϵ1-w(l)/w(r)\leq(f_{\max}/f_{\min})h_{\max}/\epsilon, giving cost O(hmax⁡/ϵ)O(h_{\max}/\epsilon). The first cell can be included in the telescoping linear sum at cost O(hmax⁡)O(h_{\max}). Since hmax⁡→0h_{\max}\to0 almost surely for an iid sample with full support, taking ϵ↓0\epsilon\downarrow0 gives ϕ(0)−ϕ(dmax⁡)+o(1)\phi(0)-\phi(d_{\max})+o(1), where dmax⁡d_{\max} is the farthest distance on the side. As z′→zz'\to z and the farthest point tends to ee, 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 xx, the sum of the two side corrections tends to

log⁡f(x)2(x−a)(b−x)F(x)(1−F(x)).(9)\log\frac{f(x)^2(x-a)(b-x)}{F(x)(1-F(x))}. \tag*{(9)}

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 ff 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 mm.

For an endpoint use the training extreme as anchor, so there is one side and the coordinate limit is log⁡(f(e)(b−a))\log(f(e)(b-a)). For a moving inserted query xm→xx_m\to x, apply Lemma 3.1 with pm=F(xm)p_m=F(x_m). On the physical scale the deterministic bound and the dense-sample limit give expectation correction (9) at xx. The same correction evaluated at xmx_m differs by o(1)o(1) 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 2log⁡m+2+2γ2\log m+2+2\gamma in the interior and log⁡m+1+γ\log m+1+\gamma elsewhere. For densities bounded away from zero and Lipschitz on the interval, our formulas decrease these constants by 5/25/2 and 11.

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 Beta⁡(1,m−2)\operatorname{Beta}(1,m-2) for m≥3m\geq3. The expected integral is Hm−2H_{m-2}. With the first gap’s unit contribution, the approximation gives 1+Hm−21+H_{m-2}, while Lemma 3.1 gives the exact Hm−1H_{m-1}. 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 1/m1/m, and its nonuniform endpoint is compatible with a (log⁡m)/m(\log m)/m correction. At the uniform endpoint the harmonic formula gives the exact leading residual −1/(2m)-1/(2m).

mmInterior queries: UniformInterior queries: f(t)=12+tf(t) = \frac{1}{2} + tLeft endpoints: UniformLeft endpoints: f(t)=12+tf(t) = \frac{1}{2} + t
320.02372 (0.00075)−0.01736 (0.00076)−0.015710.23591 (0.00026)
640.01384 (0.00040)−0.01315 (0.00041)−0.007830.15636 (0.00018)
1280.00734 (0.00023)−0.00810 (0.00024)−0.003910.09837 (0.00011)
2560.00357 (0.00015)−0.00488 (0.00015)−0.001950.05978 (0.00007)
10240.00100 (0.00007)−0.00125 (0.00007)−0.000490.02024 (0.00002)
40960.00027 (0.00003)−0.00030 (0.00003)−0.000120.00641 (0.00001)
Published2.52.511

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 [a,b]∪[c,d][a,b] \cup[c,d] with a<b<c<da < b < c < d and a positive Lipschitz density on each component. For a component I=[l,r]I = [l,r], put

R[a,b](z)=c−bc−z+log⁡d−zc−z,R[c,d](z)=c−bz−b+log⁡z−az−b.R_{[a,b]}(z) = \frac{c-b}{c-z} + \log\frac{d-z}{c-z}, \qquad R_{[c,d]}(z) = \frac{c-b}{z-b} + \log\frac{z-a}{z-b}.

For x∈(l,r)x \in(l,r), the held-out mean equals

2log⁡m+2γ−12+log⁡(f(x)2(x−l)(r−x))+RI(x)+o(1).2 \log m + 2\gamma- \frac{1}{2} + \log\bigl(f(x)^2(x-l)(r-x)\bigr) + R_I(x) + o(1).

At an endpoint ee of II, its asymptotic expression is

log⁡m+γ+log⁡(f(e)(r−l))+RI(e).\log m + \gamma+ \log\bigl(f(e)(r-l)\bigr) + R_I(e).

Between bb and cc the asymptotic expression interpolates linearly between the two endpoint expressions, and outside [a,d][a,d] it clamps to the corresponding outer endpoint.

Proof. Condition on the counts in the two components. For II of mass πI>0\pi_I > 0 the count is binomial with fraction converging to πI\pi_I, and the conditional density is f/πIf/\pi_I. 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 log⁡m+log⁡f(e)\log m + \log f(e) at an edge and 2log⁡m+2log⁡f(x)2 \log m + 2 \log f(x) in the interior. Indeed the count divided by mm 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 zz in the left component, let uu be the last point there and vv the first in the right component. The single gap (u,v)(u,v) contributes (v−u)/(v−z)(v-u)/(v-z) for anchor zz, tending to (c−b)/(c−z)(c-b)/(c-z). Beyond vv, the sum is a right-endpoint Riemann sum with denominator bounded below by c−bc-b. It tends to ∫cd(t−z)−1 dt\int_c^d (t-z)^{-1}\,\mathrm{d}t. The added terms are bounded by the full range divided by c−bc-b, 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 x∈[b,c]x \in[b,c], the same u,vu,v bracket the query and their interpolation weight tends to (c−x)/(c−b)(c-x)/(c-b). The two depths have the common leading term log⁡m\log m 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 −5/2-5/2 and the separate gap fraction in RIR_I. The outer edges require the shift −1-1 and their corresponding gap fraction. At b,cb,c this fraction is one, canceling the one-sided shift of one cut. The correct gap-adjacent logarithmic terms are log⁡((b−a)(d−b)/(c−b))\log((b-a)(d-b)/(c-b)) and log⁡((d−c)(c−a)/(c−b))\log((d-c)(c-a)/(c-b)), respectively. The printed expression at bb uses d−cd-c in the denominator.

Variance across reused reference pools

For this section the support is a single interval [a,b][a,b]. Let XN=(X1,…,XN)\mathcal{X}_N = (X_1,\ldots,X_N) be an iid reference pool. Define the complete subbagging score

UN,m(x)=(Nm)−1∑I⊆{1,…,N}∣I∣=mD(x;{Xi:i∈I}).(10)U_{N,m}(x) = \binom{N}{m}^{-1} \sum_{\substack{I \subseteq\{1,\ldots,N\} \\ |I|=m}} D\bigl(x;\{X_i:i \in I\}\bigr). \tag*{(10)}

This UU-statistic has mean μm(x)\mu_m(x), and its variance is over fresh pools. If two size-mm subsets are drawn independently conditional on the pool, the covariance of their cut-averaged depths equals Var⁡(UN,m(x))\operatorname{Var}(U_{N,m}(x)), since the draws have common conditional mean UN,m(x)U_{N,m}(x). For an average of JtreeJ_{\mathrm{tree}} conditionally independent trees with both subset and cut randomness, the additional variance is E[Var⁡(Ytree∣XN)]/Jtree\mathbb{E}[\operatorname{Var}(Y_{\mathrm{tree}}\mid\mathcal{X}_N)]/J_{\mathrm{tree}}, by total variance for a single tree depth YtreeY_{\mathrm{tree}}. 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 q(x)=min⁡(b,max⁡(a,x))q(x)=\min(b,\max(a,x)) be the effective location, since all queries on a given exterior ray have the same depth as its endpoint. Define κq=κint\kappa_q=\kappa_{\mathrm{int}} for a<q<ba<q<b and κq=κ∂\kappa_q=\kappa_{\partial} at an endpoint. The two positive constants are given by (14) below.

Theorem 3. Under the assumptions of Theorem 1, fix a query xx. For all N≥mN\ge m and sufficiently large mm, Var⁡(UN,m(x))≍m/N\operatorname{Var}(U_{N,m}(x))\asymp m/N, with positive comparison constants independent of m,Nm,N. If x′x' and x′′x'' have distinct effective locations, then

Var⁡(UN,m(x′)−UN,m(x′′))≍m/N.(11)\operatorname{Var}\bigl(U_{N,m}(x')-U_{N,m}(x'')\bigr)\asymp m/N. \tag*{(11)}

Along m→∞m\to\infty and m/N→0m/N\to0, the ratios of these variances to m/Nm/N converge to κq(x)\kappa_{q(x)} and κq(x′)+κq(x′′)\kappa_{q(x')}+\kappa_{q(x'')}, respectively. In this regime the covariance of the two distinct effective query scores is o(m/N)o(m/N). The variance constants are independent of ff and of the fixed location within each query type.

For either statistic, convergence in probability to its mean along m→∞m\to\infty holds exactly when m/N→0m/N\to0. The same criterion holds with the corresponding asymptotic mean expression from Theorem 1, or its difference for two queries.

At m=N=256m=N=256, 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 2log⁡(e1/2)=12\log(e^{1/2})=1 from a density ratio e1/2≈1.65e^{1/2}\approx1.65 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, m/N→0m/N\to0 suffices for the probability of a correct ordering to tend to one. If m/Nm/N 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 2−UN,m(x)/νm2^{-U_{N,m}(x)/\nu_m} with the common positive normalizer νm∼2log⁡m\nu_m\sim2\log m in [6, 7], the centered normalized depth converges to zero in mean square by Theorem 3. For every mm 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 SS contain m−1m-1 iid observations. For q∈[a,b]q\in[a,b] and y∈[a,b]y\in[a,b] put

Δm,q(y)=D(q;S∪{y})−D(q;S),ψm,q(y)=EΔm,q(y).(12)\Delta_{m,q}(y)=D(q;S\cup\{y\})-D(q;S),\qquad\psi_{m,q}(y)=\mathbb{E}\Delta_{m,q}(y). \tag*{(12)}

Lemma 4.1. If q∈(a,b)q\in(a,b), then Δm,q(y)\Delta_{m,q}(y) has uniformly bounded fourth moments for yy in a fixed compact neighborhood of qq inside the support. For an endpoint qq, the fourth moments are bounded uniformly in y∈[a,b]y\in[a,b]. For each effective location qq there is a constant CqC_q such that, for all m≥2m\ge2 and all y∈[a,b]y\in[a,b],

∣ψm,q(y)∣≤Cq1+m∣y−q∣.(13)\lvert\psi_{m,q}(y)\rvert\le\frac{C_q}{1+m\lvert y-q\rvert}. \tag*{(13)}

Proof. For any old training anchor, insertion within a gap whose near and far distances are ℓ<r\ell<r changes its depth by

(h−ℓ)(1/h−1/r),ℓ<h<r,(h-\ell)(1/h-1/r),\qquad\ell<h<r,

where hh is the distance to the inserted point. This is in [0,1][0,1]; if insertion extends the range, use 1/r=01/r=0. Thus on the event that SS brackets an interior qq, 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

[equation continues on the next page]\text{[equation continues on the next page]}

bound. For the new anchor yy, 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 y=qy=q. Their difference has bounded fourth moment by the triangle inequality in L4L^4, with centering at 2log⁡m2\log m, since 2log⁡(m−1)−2log⁡m2\log(m-1)-2\log m 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 mm.

At q=aq=a the score is the depth of the sample minimum ZZ. If y>Zy>Z, the old anchor increment is bounded by one. If y<Zy<Z, the new minimum has increment 1−Q(V,Z−y)1-Q(V,Z-y), where VV lists the distances from ZZ to the remaining old points. For J=8J=8 the tail bound gives Q(V,Z−y)≤J+(Z−a)/VJQ(V,Z-y)\le J+(Z-a)/V_J if there are at least JJ terms, and Q(V,Z−y)≤JQ(V,Z-y)\le J otherwise. On transforming to the uniform scale, the ratio is bounded by fmax⁡/fmin⁡f_{\max}/f_{\min} times the corresponding uniform ratio. With normalized exponential spacings, that ratio is E1/(E2+⋯+EJ+1)E_1/(E_2+\cdots+E_{J+1}). Its fourth moment is finite. Reflection gives the same conclusion at bb.

For the envelope, let s=∣y−q∣>0s=|y-q|>0 and first take y>qy>q. In the interior, with probability at least 1−2e−βqms1-2e^{-\beta_qms}, an old training point on each side lies within s/2s/2 of qq, for some βq>0\beta_q>0. Indeed the intervals truncated to the support each have length at least a fixed positive multiple of ss, since s≤b−as\le b-a and qq is fixed. At the left endpoint use the event Z≤a+s/2Z\le a+s/2, with the same exponential bound. On these events the anchors and weights stay the same after insertion, and each anchor lies at least s/2s/2 to the left of yy. The increment at each anchor is bounded by 2By/s2B_y/s, where ByB_y is the distance back to the closest old observation to the left of yy, using aa if none exists. This follows from the increment formula and 1/h−1/r≤1/h1/h-1/r\le1/h; the preceding point is at or beyond each anchor. The tail of ByB_y is bounded by e−(m−1)fmin⁡ue^{-(m-1)f_{\min}u} over 0<u<y−a0<u<y-a, so EBy≤[(m−1)fmin⁡]−1\mathbb{E}B_y\le[(m-1)f_{\min}]^{-1}.

On the complementary event use Cauchy–Schwarz and the second moments just established when yy is near qq, and for all yy at the endpoint. For yy outside the interior neighborhood, ss is bounded below by a positive number, so the crude bound mm times 2e−βqms2e^{-\beta_qms} is also exponentially small in msms, with a modified exponent. Reflection treats insertions to the left. Combining the bounds gives O((ms)−1)+O(e−βq′ms)O((ms)^{-1})+O(e^{-\beta'_qms}) when ms≥1ms\ge1. For ms<1ms<1 the local moment bound suffices, enlarging the constant for finitely many small mm 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 tt. The limiting expected depth difference as the window expands is denoted by Ψint(t)\Psi_{\mathrm{int}}(t). For an endpoint, use a unit-rate process on the positive half-line and t≥0t\ge0, with the query clamped to the first observation, to obtain Ψ∂(t)\Psi_{\partial}(t). Then

κint=∫RΨint(t)2 dt,κ∂=∫0∞Ψ∂(t)2 dt.(14)\kappa_{\mathrm{int}}=\int_{\mathbb{R}}\Psi_{\mathrm{int}}(t)^2\,dt,\qquad \kappa_{\partial}=\int_0^\infty\Psi_{\partial}(t)^2\,dt. \tag*{(14)}

Lemma 4.2 (Local Poisson limit). For fixed qq in the interior and t∈Rt\in\mathbb{R}, the limit defining Ψint(t)\Psi_{\mathrm{int}}(t) exists and

ψm,q(q+tmf(q))⟶Ψint(t).\psi_{m,q}\left(q+\frac{t}{m f(q)}\right)\longrightarrow\Psi_{\mathrm{int}}(t).

At q=aq=a the same convergence holds to Ψ∂(t)\Psi_{\partial}(t) for t≥0t\ge0; at q=bq=b use y=b−t/(mf(b))y=b-t/(m f(b)).

Proof. On the probability scale the normalized exponential coupling of Lemma 3.2, used with m−1m-1 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 mf(q)m f(q), since F(q+s)−F(q)=f(q)s+o(s)F(q+s)-F(q)=f(q)s+o(s). 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 M>∣t∣M>|t| and suppose the original scoring anchors are all in [−M,M][-M,M]. After insertion the scoring anchors stay in that interval. Take L>2ML>2M and suppose there is a retained observation between L/2L/2 and LL on each relevant side. A discarded gap on the right, including a gap crossing the truncation boundary, then has endpoints u,vu,v with v>u≥L/2v>u\ge L/2. The contribution at an anchor z∈[−M,M]z\in[-M,M] differs from its value with denominator vv by at most

∣v−uv−z−v−uv∣≤M(v−u)(v−M)2.\left|\frac{v-u}{v-z}-\frac{v-u}{v}\right|\le\frac{M(v-u)}{(v-M)^2}.

Summing over discarded gaps bounds the difference on that side by M∫L/2∞(s−M)−2 ds=M/(L/2−M)M\int_{L/2}^{\infty}(s-M)^{-2}\,ds=M/(L/2-M). 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 4M/(L/2−M)4M/(L/2-M) 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 MM 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 LL 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 QQ, each with shift no greater than the old width GG. Thus the paired difference is dominated by 4+2Q(τ−,G)+2Q(τ+,G)4+2Q(\tau^{-},G)+2Q(\tau^{+},G), where τ±\tau^{\pm} are the full outward arrival sequences. This bound is integrable by (7). On the half-line an insertion before the old minimum ZZ is bounded by 1+Q(τ,Z)1+Q(\tau,Z), 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 LL and the Poisson count plus one has second moment O((1+L)2)O((1+L)^2). These bounds justify taking the Poisson expectation in the limit.

Lemma 4.3 (Explicit profiles). For s>0s>0, define

χ(s)=∫0∞1−e−vvss+v dv,ρ(s)=1s−E1s+E,E∼Exp⁡(1),(15)\chi(s)=\int_{0}^{\infty}\frac{1-e^{-v}}{v}\frac{s}{s+v}\,dv,\qquad\rho(s)=\frac{1}{s}-\mathbb{E}\frac{1}{s+E},\qquad E\sim\operatorname{Exp}(1), \tag*{(15)}

and set χ(0)=0\chi(0)=0. The endpoint profile is

Ψ∂(t)=∫0te−z(1−e−(t−z))ρ(t−z) dz.(16)\Psi_{\partial}(t)=\int_{0}^{t}e^{-z}(1-e^{-(t-z)})\rho(t-z)\,dz. \tag*{(16)}

The interior profile is even. For t≥0t\ge0 let A−,A+A_{-},A_{+} be independent rate-one exponentials and g=A−+A+g=A_{-}+A_{+}. Its value is the expectation of

(1−e−s)[λρ(t+A−)+(1−λ)ρ(s)],s=t−A+,λ=A+/g,(17)(1-e^{-s})[\lambda\rho(t+A_{-})+(1-\lambda)\rho(s)],\qquad s=t-A_{+},\quad\lambda=A_{+}/g, \tag*{(17)}

on t>A+t>A_{+}, and of

αg2g+(1−α)[1+χ(g)−χ(g1)−χ(g2)],g1=A−+t,g2=A+−t,α=t/g1,(18)\alpha\frac{g_{2}}{g}+(1-\alpha)[1+\chi(g)-\chi(g_{1})-\chi(g_{2})],\qquad g_{1}=A_{-}+t,\quad g_{2}=A_{+}-t,\quad\alpha=t/g_{1}, \tag*{(18)}

on t<A+t<A_{+}, with each contribution weighted by its event probability. The constants in (14) are finite and strictly positive.

Proof. For the rate-one outward arrivals τj\tau_j, the jjth gap fraction conditional on τj\tau_j has mean 1/j1/j. Summing the gamma densities with weights 1/j1/j gives (1−e−v)/v(1-e^{-v})/v, so χ(s)=EQ(τ,s)\chi(s)=\mathbb{E}Q(\tau,s). For numerical evaluation one can use

χ(s)=γ+log⁡s+es∫s∞e−vdvv.\chi(s)=\gamma+\log s+e^{s}\int_{s}^{\infty}e^{-v}\frac{dv}{v}.

Both expressions vanish at zero. Differentiating the integral and integrating by parts gives the common derivative

∫0∞1−e−v(s+v)2 dv=es∫s∞e−vdvv.\int_0^\infty\frac{1-e^{-v}}{(s+v)^2}\,\mathrm{d}v=e^s\int_s^\infty e^{-v}\frac{\mathrm{d}v}{v}.

At an endpoint the minimum ZZ is exponential. Given Z>tZ>t, the shift Z−tZ-t is rate-one exponential and independent of the process beyond ZZ, so the mean increment is 1−H1=01-H_1=0 by (7). If Z<tZ<t, the backward gap from tt is the smaller of t−Zt-Z and a rate-one exponential. Its mean is 1−e−(t−Z)1-e^{-(t-Z)}, and the independent forward gap is exponential. The gap update at ZZ has conditional mean (1−e−(t−Z))ρ(t−Z)(1-e^{-(t-Z)})\rho(t-Z), giving (16).

In the interior, reflection gives the claimed evenness. Given the two original neighbors, insertion at t>A+t>A_+ leaves both interpolation anchors unchanged. The backward gap has mean 1−e−s1-e^{-s} by the same truncated exponential calculation with A+A_+ as the leftmost point to the right of zero. The independent forward gap is exponential, so weighting the two anchor increments gives (17). If t<A+t<A_+, the left anchor acquires g2/gg_2/g by splitting the bracket gap, and the new anchor at tt has two first gaps of contribution one each. The outward baseline sums stay the same. The expected outward correction at the new anchor is χ(g1)+χ(g2)\chi(g_1)+\chi(g_2) in place of the old query’s expected correction χ(g)\chi(g). The new weight on the left anchor is α\alpha, giving (18).

At zero, (7) gives Ψint(0)=1+H2−2H1=1/2\Psi_{\mathrm{int}}(0)=1+H_2-2H_1=1/2. As t↓0t\downarrow0, the term (17) is bounded by one on an event of vanishing probability, and (18) converges by domination by 2+3χ(g)2+3\chi(g). Thus Ψint\Psi_{\mathrm{int}} is continuous at zero. The endpoint profile is strictly positive for t>0t>0 because ρ(s)>0\rho(s)>0 for s>0s>0. 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 qq is

ηm,q(y)=ED(q;S∪{y})−μm(q)=ψm,q(y)−Eψm,q(X1).\eta_{m,q}(y)=\mathop{\mathrm{E}}D(q;S\cup\{y\})-\mu_m(q)=\psi_{m,q}(y)-\mathop{\mathrm{E}}\psi_{m,q}(X_1).

The envelope (13) gives E∣ψm,q(X1)∣=O(log⁡m/m)\mathop{\mathrm{E}}|\psi_{m,q}(X_1)|=O(\log m/m). In mEψm,q(X1)2m\mathop{\mathrm{E}}\psi_{m,q}(X_1)^2, change variables by writing y=q+t/(mf(q))y=q+t/(mf(q)), reflected at bb. The resulting density factor f(y)/f(q)f(y)/f(q) tends to one and is bounded. Lemma 4.2 and the square of (13) give dominated convergence. The squared centering term times mm vanishes, so

mEηm,q(X1)2⟶κq.m\mathop{\mathrm{E}}\eta_{m,q}(X_1)^2\longrightarrow\kappa_q.

For distinct q,q′q,q', split at the midpoint between them. On either piece at least one profile is O(1/m)O(1/m) uniformly. The L1L^1 bounds and the centering terms therefore give

mE[ηm,q(X1)ηm,q′(X1)]⟶0.m\mathop{\mathrm{E}}\left[\eta_{m,q}(X_1)\eta_{m,q'}(X_1)\right]\longrightarrow0.

The leading kernel projection for a contrast has variance constant κq+κq′\kappa_q+\kappa_{q'}.

For either kernel hmh_m (one query or the contrast), let vm,jv_{m,j} denote the variance of its order-jj canonical Hoeffding kernel [5]. Its full variance is ∑j=1m(mj)vm,j\sum_{j=1}^{m}\binom{m}{j}v_{m,j}, since the components are orthogonal by conditional centering in every argument. Counting how often a fixed jj-subset occurs in (10) gives its coefficient (mj)/(Nj)\binom{m}{j}/\binom{N}{j} and the variance formula

Var⁡(U)=m2Nvm,1+∑j=2m(mj)(Nj)(mj)vm,j.(19)\operatorname{Var}(U)=\frac{m^2}{N}v_{m,1}+\sum_{j=2}^{m}\frac{\binom{m}{j}}{\binom{N}{j}}\binom{m}{j}v_{m,j}. \tag*{(19)}

Here mvm,1mv_{m,1} tends to the positive constant just proved. Lemma 3.3 bounds Var⁡(hm)\operatorname{Var}(h_m) uniformly, subtracting 2log⁡m2\log m or log⁡m\log m at each effective location. The binomial ratio is at most (m/N)j(m/N)^j, so the variance of the terms of order at least two is at most (m/N)2Var⁡(hm)(m/N)^2\operatorname{Var}(h_m). 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 m/N→0m/N\to0, 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 ⌈log⁡2ψ⌉\lceil\log_2 \psi\rceil for subsample size ψ\psi and adds c(nleaf)c(n_{\mathrm{leaf}}) to the traversed depth at a terminal node containing nleafn_{\mathrm{leaf}} 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 Mm(x)M_m(x) 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 [0,1][0,1]. The interior queries use the same probability coordinate p=0.3p = 0.3. They are x=0.3x = 0.3 for the uniform law and x=0.85−0.5≈0.422x = \sqrt{0.85} - 0.5 \approx0.422 for density f(t)=12+tf(t) = \frac{1}{2} + t. Both left-endpoint queries are x=0x = 0.

Across m=256m = 256 to 40964096, the effective exponents −log⁡(∣r4096/r256∣)/log⁡(16)-\log(\lvert r_{4096}/r_{256}\rvert)/\log(16) 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 mrmmr_m 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, Hm−1−log⁡m−γ=−1/(2m)+O(m−2)H_{m-1} - \log m - \gamma= -1/(2m) + O(m^{-2}).

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 ww and bracket width gg, the expected tail is χ(w+g)−χ(w)\chi(w+g)-\chi(w), using χ\chi from the main paper. Indeed, the future arrival at distance vv from ww has expected increment v/jv/j conditional on being the jjth future arrival. Summing those densities yields the integrand g(1−e−v)/((w+v)(w+g+v))g(1-e^{-v})/((w+v)(w+g+v)). The unconditional weighted Poisson correction is 3/23/2, 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 [0,1]∪[4,6][0,1] \cup[4,6], 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, 0.4(12+x)0.4(\frac{1}{2} + x) on [0,1][0,1] and 0.3(1.5−(x−4)/2)0.3(1.5 - (x - 4)/2) on [4,6][4,6]. 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 x=0x = 0. 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 0.4m0.4m. Rescaling the single-interval residual at m=4096m = 4096 to that count using the suggested (log⁡m)/m(\log m)/m 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 x=2x = 2, 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 κint≈0.4548\kappa_{\mathrm{int}} \approx0.4548 and κ∂≈0.1526\kappa_{\partial} \approx0.1526. 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 κint\kappa_{\mathrm{int}} differ by about 1.5×10−51.5 \times10^{-5}. Direct paired Monte Carlo estimates of each profile at t=0,0.5,2,4t = 0, 0.5, 2, 4, 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 N/mN/m scaling also multiplies the Monte Carlo errors.

NNInterior x=0.3x = 0.3Endpoint x=0x = 0Contrast 0.3 vs. 0.7
2560.5237 (0.0041)0.3509 (0.0027)1.0790 (0.0085)
10240.4416 (0.0122)0.1547 (0.0078)0.8876 (0.0245)
40960.4103 (0.0476)0.1768 (0.0307)0.8607 (0.0958)
Small-fraction limit0.45480.15260.9096

Table S2. Shared-pool estimates of (N/m)Var⁡(U)(N/m)\operatorname{Var}(U) for f(t)=12+tf(t) = \frac{1}{2} + t, m=256m = 256. Parentheses give Monte Carlo standard errors. For N=mN = m 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 N=4096N = 4096. To check the leading constants more precisely, we evaluate the finite-sample influence ψm,q\psi_{m,q} directly by paired insertion for f(x)=12+xf(x) = \frac{1}{2} + x on [0,1][0, 1], at q=0.3q = 0.3 and q=0q = 0. At each forced location yy, the depths with and without the forced point share the same m−1m - 1 observations. The integration coordinate t=m(F(y)−F(q))t = m(F(y) - F(q)) gives m dF(y)=dtm\,\mathrm{d}F(y) = \mathrm{d}t, so the raw target is mE[ψm,q(X)2]m\mathbb{E}[\psi_{m,q}(X)^2]. The centered target mVar⁡(ψm,q(X))m\operatorname{Var}(\psi_{m,q}(X)) 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 ψm,q2\psi_{m,q}^2 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 mm. We average over 48 independent blocks and compute standard errors across blocks. Composite Simpson quadrature covers the entire support in the tt coordinate, using spacing 1/81/8 out to ∣t∣=8|t| = 8 and eight subintervals per dyadic band in the tails. Comparing to the grid with every other point removed checks sensitivity to spacing.

mmInterior q=0.3q = 0.3Endpoint q=0q = 0
RawCenteredRawCentered
2560.4566 (0.0014)0.4407 (0.0014)0.1492 (0.0014)0.1455 (0.0014)
10240.4562 (0.0016)0.4522 (0.0016)0.1525 (0.0016)0.1516 (0.0016)
40960.4551 (0.0013)0.4541 (0.0013)0.1545 (0.0017)0.1543 (0.0016)
Poisson limit0.45480.45480.15260.1526

Table S3. Direct finite-bag estimates of mE[ψm,q(X)2]m\mathbb{E}[\psi_{m,q}(X)^2] (raw) and mVar⁡(ψm,q(X))m\operatorname{Var}(\psi_{m,q}(X)) (centered). Parentheses give Monte Carlo standard errors.

At m=4096m = 4096, 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 m=4096m = 4096 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 {0,1,3,4,7,10,12}\{0, 1, 3, 4, 7, 10, 12\} and half-unit queries from −1-1 through 13. The implementations also check the harmonic endpoint and the limiting mean bracket correction.

The original population simulations use the uniform density and 2(1+t)/32(1+t)/3 on [0,1][0,1], bag sizes 128, 512, 2048, and 8,192 replicates per size and density. At m=2048m = 2048 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 x=1/4x = 1/4 is 0.5690 and 0.5817 in the two implementations. At m=512m = 512, forcing an observation at x=1/2x = 1/2 or at x+0.02/mx + 0.02/m 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.

NNDirect pool samplingHypergeometric overlap
1280.5049 (0.0056)0.5194 (0.0058)
2560.2211 (0.0044)0.2243 (0.0045)
10240.0525 (0.0040)0.0520 (0.0041)

Table S4. Original covariance checks for m=128m = 128 and uniform x=1/2x = 1/2. The N=128N = 128 row estimates Var⁡(Dm)\operatorname{Var}(D_m), since both bags are the full pool. Parentheses give Monte Carlo standard errors.

References

  1. [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. [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. [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. [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. [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. [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. [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. [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. [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. [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. [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. [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. [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.

How machine contributions are recorded

Paper details

Citation

Cite
Published
Version
Latest

Data & code

Code, data, proofs and workflows the authors linked for testing, review and reproduction. These links are part of this work’s metadata and are released under the same license as the rest of that metadata. Valency doesn’t host the files; each keeps the license set where it’s hosted.

Contents

Pick where to look, or just type