RaSEn R quickstart: classify with random subspace ensembles

Compare random subspace ensemble classification with full-feature LDA on an independent test set using the RaSEn R package.

All software quickstarts · Classification paper · CRAN package and manual

Try RaSE when you have many predictors and suspect only a few carry signal. Rather than fitting one classifier on every variable, RaSE fits multiple classifiers on small subsets of predictors. It chooses a subset for each learner from a set of random candidates, then combines the learners’ votes.

1. Install RaSEn

install.packages("RaSEn")

2. Compare RaSE with full-feature LDA

This simulation has 100 predictors but only the first three differ between the two classes. Both methods use linear discriminant analysis (LDA) and the same 160 training observations. The baseline uses all 100 predictors. RaSE combines B1 = 40 learners, choosing from B2 = 60 candidate subsets per learner, with at most D = 5 predictors per subset. Neither model uses the 1,000 test observations for fitting or subspace selection.

set.seed(2026)

draw <- function(n) {
  y <- rep(0:1, each = n / 2)
  x <- matrix(rnorm(n * 100), nrow = n)
  x[, 1:3] <- x[, 1:3] + y
  list(x = x, y = y)
}

train <- draw(160)
test <- draw(1000)

# Same base learner and same held-out test set for both fits.
baseline <- MASS::lda(train$x, grouping = factor(train$y))
rase <- RaSEn::Rase(
  train$x, train$y, base = "lda", criterion = "ric",
  B1 = 40, B2 = 60, D = 5, cores = 1, seed = 2026
)

lda_pred <- predict(baseline, newdata = test$x)$class
rase_pred <- predict(rase, newx = test$x, type = "vote")
test_error <- c(
  full_feature_lda = mean(lda_pred != test$y),
  rase_lda = mean(rase_pred != test$y)
)
print(round(test_error, 3))

3. Read the results

With R 4.5.0 and RaSEn 3.0.0, the test misclassification rate is 33.5% for full-feature LDA and 25.0% for RaSE. In this simulation, combining small subsets helps when most predictors are noise. This is a worked example, not a benchmark or a guarantee that RaSE will beat LDA on other data.

The example uses a small search budget to keep it quick. For your own data, compare against a baseline and tune the search budget on training or validation data, not on the final test set.

Looking for variable screening instead?

Use RaScreen() to rank predictors for screening rather than to produce class predictions. The variable screening paper describes that separate procedure.

Cite the classification method

Tian, Y., and Feng, Y. (2021). RaSE: Random Subspace Ensemble Classification. Journal of Machine Learning Research, 22(45), 1–93. Journal article · BibTeX on the paper page.