                                       Mixed-Curvature Decision Trees and Random Forests



Algorithm 1 Product Space Decision Tree                                  cally equidistant from the two points to either side of it

 1: Procedure F IT(P, X, y):                                             (Euclidean DTs do this by sample-averaging the threshold

 2: for each component M of P do                                         values). Angular midpoints for each component manifold

 3:    for each dimension d > 0 of M do                                  are described in the following sections and summarized in

 4:       θi,d ← tan−1 (xi,0 /xi,d ) {Eq. 15}                            Table 5 in the Appendix.

 5:    end for                                                           With the angular features and manifold-informed midpoint

 6: end for                                                              modifications in place, the rest of the algorithm follows

 7: return F IT N ODE(Θ, y, 0)                                           Section 2.2 unmodified.

 8:

 9: Procedure F IT N ODE(Θ, y, depth):                                   3.1. Euclidean decision trees

10: if depth = max depth or other stopping criteria then

11:    return Leaf(y)                                                    To unify our treatment of all three geometries, we first re-

12: end if                                                               formulate the standard Euclidean DT in a geometrically-

13: (d∗ , θ ∗ , IG∗ ) ← (−, −, −∞)                                       informed, albeit unconventional, way that is equivalent to

14: for each dimension d of Θ do                                         the classical model.

15:    for each θ ∈ G ET C ANDIDATES(Θ, d) do                            While the intersections of homogenous hyperplanes in RD

16:       Partition (Θ, y) → (Θ± , y± ) via Eq. 16                       with ED are (trivially) convex, these lack the expressiveness

17:       IG ← Eq. 13 on (y+ , y− )                                      of an ambient-space formulation. Thus, we embed ED in

18:       if IG > IG∗ then                                               RD+1 by a trivial lift:

19:            (d∗ , θ∗ , IG∗ ) ← (d, θ, IG)

20:       end if                                                                      ϕ : ED → RD+1 , ϕ(u) = (1, u).              (17)

21:    end for

22: end for                                                              For two points u, v ∈ ED , the midpoint angles in ED can

23: if IG∗ = −∞ then                                                     be described in terms of the coordinates of u and v or their

24:    return Leaf(y)                                                    respective projection angles (θu , θv ) as

25: else

                                                                              mE (u, v) = tan−1 (2/(ud + vd ))                    (18)

26:    N ← Node(d∗ , θ∗ )

                                                                                               −1

27:    N .left ← F IT N ODE(Θ− , y− , depth+1)                                           = tan      (2/(cot(θu ) + cot(θv )))     (19)

28:    N .right ← F IT N ODE(Θ+ , y+ , depth+1)

29:    return N                                                          See Appendix B for a proof that this formulation is equiva-

30: end if                                                               lent to thresholding on basis dimensions.

31:

32: Procedure G ET C ANDIDATES(Θ, d):                                    3.2. Hyperbolic decision trees

33: θ̃ ← sorted unique Θ:,d                                              For two points u, v ∈ HD,K , we compute θu and θv accord-

34: return {mM (θ̃i , θ̃i+1 )}i {Eqs. 18–22}                             ing to Eq 15 and follow Chlenski et al. (2024) in computing

                                                                         the hyperbolic midpoint angle in HD,K as:



to thresholding on angles under 2-dimensional projections.                                 sin(2θu − 2θv )

                                                                                 V :=                             ,    (20)

                                                                                      sin(θu + θv ) sin(θv − θu )

We consider the set of all projections onto the basis {x0 , xd },                     (            √

which are computable in O(1) time per projection by coor-                              cot−1 (V − V 2 − 1) if θu + θv < π

                                                                          mH (u, v) =              √

dinate selection. First, we compute the projection angle:1                             cot−1 (V + V 2 − 1) otherwise.

                  θ(x, d) = tan−1 (x0 /xd ).                 (15)                                                      (21)



Next, we use a modified splitting criterion to account for               3.3. Hyperspherical decision trees

the geometry of angular splits:

                                                                         The hyperspherical case is quite simple, except that unlike

           S(x, d, θ) = I{θ(x, d) ∈ [θ, θ + π)}.             (16)        hyperbolic space and the “lifted” Euclidean space after ap-

                                                                         plying Eq 17, we lack a natural choice of x0 . We adopt the

Once the best angle is selected, we must compute angular                 convention of fixing the first dimension of the embedding

midpoints to select P that intersects M at a point geodesi-              space as x0 , which intuitively corresponds to fixing a “north

                                                                         pole” at the origin µ0 = (1/|K|, 0, . . .).

   1

    We use the PyTorch arctan2 function to ensure that we can

recover the full range of angles in [0, 2π). This is essential for       Angular midpoints are particularly well-behaved in hyper-

properly specifying decision boundaries in S.                            spherical manifolds: given u, v ∈ SD,K , the hyperspherical



                                                                     5

