library(aorsf)
library(ranger)
library(survival)
library(microbenchmark)
suppressPackageStartupMessages(library(obliqueRSF))
pbc <- pbc_orsf
pbc$id <- NULL
set.seed(329)
bm <- microbenchmark(
aorsf = orsf(
Surv(time, status) ~ ., data = pbc, n_tree = 50
),
aorsf_glmnet = orsf(
Surv(time, status) ~ ., data = pbc, n_tree = 50,
control = orsf_control_survival(method = "net")
),
obliqueRSF = ORSF(
data = pbc, time = "time", status = "status",
ntree = 50, verbose = FALSE
),
ranger = ranger(
Surv(time, status) ~ ., data = pbc, num.trees = 50
),
times = 5
)Random forests usually split each tree node on a single variable. An oblique random forest splits on a linear combination of variables instead. Leo Breiman suggested this idea in his original random forest paper, but it was rarely used because finding good linear combinations is slow. My research on oblique random survival forests (ORSF) has worked on making the method fast, accurate, and interpretable for time-to-event outcomes, and on making it easy to use in R.
Papers
Oblique random survival forests (Annals of Applied Statistics, 2019). This paper introduced the ORSF, which uses regularized Cox regression to find linear combinations of predictors at each split. It showed strong prognostic performance compared with standard random survival forests, conditional inference forests, regression, and boosting, and included an application to predicting atherosclerotic cardiovascular disease risk in the Jackson Heart Study. Details
Accelerated and interpretable oblique random survival forests (Journal of Computational and Graphical Statistics, 2023). This paper introduced the methods behind
aorsf: Newton-Raphson scoring to fit split rules quickly, and negation importance to measure variable importance. Large benchmarks showed that it is both accurate and fast. Details · Benchmark code
Software: aorsf
aorsf fits oblique random forests for survival, classification, and regression, with tools for interpretation such as partial dependence, individual conditional expectations, and variable importance. It works as an engine in tidymodels (through bonsai and censored) and in mlr3.
aorsf began as the obliqueRSF package, which accompanied the 2019 paper but was slow and had few tools for interpretation. When aorsf was peer reviewed by rOpenSci, it fit only survival forests. One reviewer, Marvin N. Wright (author of ranger), asked a good question: why not make one fast oblique random forest package for every type of outcome? Other packages, like obliqueRF, RLT, and rotationForest, provided specific kinds of oblique forests, but none brought them together. Today, aorsf covers classification, regression, and survival.
A small benchmark
How fast is aorsf? The benchmark below fits a 50-tree survival forest to the primary biliary cholangitis data (pbc_orsf, 276 patients and 17 predictors) with four approaches:
aorsfwith its default Newton-Raphson scoring to find linear combinationsaorsfwith penalized Cox regression (glmnet) to find linear combinations, the approach used in the 2019 paperobliqueRSF, the original implementation from the 2019 paper (archived from CRAN; install withremotes::install_github("bcjaeger/obliqueRSF"))ranger, a fast and widely used axis-based random survival forest, for reference
Time to fit each forest over 5 runs, in seconds:
print(bm, unit = "s", signif = 3)Unit: seconds
expr min lq mean median uq max neval cld
aorsf 0.0208 0.0228 0.0286 0.0252 0.0281 0.0463 5 a
aorsf_glmnet 3.9700 4.1000 4.2400 4.2700 4.3400 4.5300 5 b
obliqueRSF 6.8200 7.0800 7.3400 7.3800 7.5800 7.8300 5 c
ranger 0.0625 0.0704 0.0858 0.0712 0.0992 0.1260 5 a
The same results relative to the fastest approach:
print(bm, unit = "relative", signif = 3)Unit: relative
expr min lq mean median uq max neval cld
aorsf 1 1.00 1.00 1.00 1.00 1.00 5 a
aorsf_glmnet 191 180.00 148.00 170.00 154.00 97.80 5 b
obliqueRSF 328 310.00 256.00 293.00 270.00 169.00 5 c
ranger 3 3.08 2.99 2.83 3.53 2.72 5 a
In this run, aorsf fit an oblique forest faster than ranger fit an axis-based one, and far faster than either approach based on penalized regression. Timings depend on the data and hardware, so treat them as a rough guide. See the JCGS paper and its benchmark code for a large, systematic comparison of speed and prediction accuracy across many datasets.
Talks and workshops
Oblique random forests: making Leo Breiman’s masterpiece accessible and interpretable with
aorsf(2025). An overview of howaorsfavoids computational bottlenecks, with demonstrations in base R,mlr3, andtidymodels. Slides · CodeOblique and causal random forests, MELODEM data workshop (2024). A hands-on workshop that uses random forests to predict dementia risk and to study heterogeneity in the association between APOE4 and dementia. Slides and workshop site · Code
R/Medicine demo day:
aorsf. A live demonstration of fitting and interpreting oblique random survival forests, with a light introduction to supervised learning, random forests, and oblique trees. Video · Slides · CodeFast code for statisticians, JSM (2022). Four ideas for writing faster R packages with
Rcpp, drawn from my experience developing ORSF software. Slides
Example code
aorsfdocumentation: getting started, interpretation, and articles on oblique splitting.- targets-tidymodels: a
targetspipeline that tunes and compares survival models intidymodels, includingaorsf.
Working with me on ORSF
If you are thinking about using oblique random forests for risk prediction, heterogeneity of treatment effects, or variable selection in a cohort study, trial, or real-world dataset, I’m happy to talk. You can reach me through GitHub or at Perisphere Real World Evidence.