Random Forest Autoencoders for Guided Representation Learning

Adrien Aumon, Shuang Ni, Myriam Lizotte, Guy Wolf, Kevin R. Moon, Jake Slater Rhodes

Visualizing high-dimensional data is a cornerstone of modern data science, but most popular tools (like t-SNE or UMAP) are unsupervised—they show the "shape" of the data without considering the labels or tasks you actually care about. While supervised methods exist, they often struggle to handle new data points or scale to massive datasets.

In their NeurIPS paper, "Random Forest Autoencoders for Guided Representation Learning," Adrien Aumon and colleagues introduce RF-AE, a framework that combines the interpretability of Random Forests with the scalability of deep learning to create a "GPS" for supervised data visualization.

TL;DR

RF-AE is a neural network-based framework that enables supervised data visualization for "out-of-sample" data (new points not seen during training). By combining Random Forest proximities with autoencoder architectures, it produces embeddings that are more accurate, more interpretable, and significantly faster at inference than previous state-of-the-art methods.

What Problem Does This Paper Address?

Manifold learning helps us see patterns in complex data by squashing it into 2D or 3D maps. However, two major gaps exist:

  1. Supervision Gap: Standard tools often ignore expert labels (like disease types or cell categories), potentially highlighting irrelevant noise instead of the features that matter for a specific task.
  2. The "Out-of-Sample" (OOS) Problem: Powerful supervised methods like RF-PHATE are "non-parametric." They can map a fixed set of points beautifully, but if you get a new data point tomorrow, you usually have to rerun the entire algorithm. Existing "extensions" to handle new data often distort the geometry or fail to generalize.

The authors set out to create a method that is supervised (guided by labels), parametric (has a reusable mapping function), and scalable.

Methods

The core of the paper is the Random Forest Autoencoder (RF-AE).

Architecture of the Random Forest Autoencoder (RF-AE), illustrating the dual-loss framework.

Here is how the framework operates:

  1. The Input (RF-GAP): Instead of feeding raw pixels or features into the network, the model uses "Random Forest-derived proximities." Essentially, a Random Forest is trained on the data to measure how often two points end up in the same leaf node. This naturally filters out "junk" features that do not help with the classification task.
  2. The Architecture: The system employs a multi-task Autoencoder. The Encoder compresses the proximity data into a 2D bottleneck, and the Decoder tries to reconstruct the original proximity vector.
  3. The Loss Function: A dual-purpose loss is utilized. One part ensures the network can reconstruct the proximities (using Jensen-Shannon Divergence), while the other part (the "geometric regularizer") forces the 2D points to match the high-quality geometry of a precomputed RF-PHATE embedding.
  4. Prototype Selection: To prevent the input layer from exploding in size as the dataset grows, a "class-wise prototype selection" strategy (using $k$-medoids) is applied. This allows the model to represent a million points using only a few hundred "representative" landmarks.

Datasets

The authors validated RF-AE across 20 diverse datasets spanning multiple modalities:

  • Images: Sign MNIST (hand gestures), OrganC MNIST (medical imaging), and standard MNIST/Fashion-MNIST.
  • Tabular/Clinical: QSAR Biodegradation, Obesity levels, and Heart health data.
  • Audio: GTZAN (music genre classification).
  • Sensors: Human Activity Recognition (HAR) and satellite data.

Key Insights and Ideas

  • Structural Importance Alignment (SIA): The authors introduce a new metric, SIA, to evaluate if an embedding is actually "useful." It measures whether the features the embedding relies on to "shape" the clusters are the same features a classifier needs to "label" the clusters.
  • Expanding the Clusters: A common complaint with supervised visualization is that it "crushes" classes into tight, uninformative dots. RF-AE actually expands these clusters, revealing internal structure (e.g., in Sign MNIST, it shows a smooth transition of hand orientations within a single letter category).
  • Modality Agnostic: Because the network operates on Random Forest proximities rather than raw data, it doesn't care if your input is an image, a sound wave, or a medical spreadsheet. It treats them all through the lens of "how similar are these points to my task?"

Key Results

Quantitative comparison of RF-AE against baseline methods across SIA metrics and k-NN accuracy.
  • Superior Accuracy: RF-AE outperformed 13 baselines (including Parametric UMAP and t-SNE) in $k$-NN accuracy across the 20 datasets.
  • Better Generalization: On the SIA metric, RF-AE consistently ranked in the top two, proving it preserves meaningful supervised structures better than "class-conditional" methods that often distort data to force separation.
  • Massive Speedup: At inference time (mapping new data), RF-AE is roughly two orders of magnitude faster than the standard RF-PHATE kernel extension.
  • Robustness: The model showed high stability across a wide range of hyperparameters, making it "plug-and-play" for researchers who don't want to spend weeks tuning a neural network.

Limitations and Future Work

  • Initial Training Cost: While inference is lightning-fast, the initial training still requires computing a full Random Forest proximity matrix, which can be a bottleneck for extremely large datasets (though the authors' prototype strategy mitigates this).
  • Label Bias: Like all supervised methods, if the expert labels used for training contain social or demographic biases, the resulting visualization will likely bake those biases into the geometry.
  • Future Directions: The authors suggest exploring RF-AE for semi-supervised learning (where only some data is labeled) and hierarchical clustering to find "sub-types" within supervised categories.

Check out the code: https://github.com/JakeSRhodesLab/RF-AE

Summary updated

BibTeX
@inproceedings{aumon2025random,
  author = {Adrien Aumon and Shuang Ni and Myriam Lizotte and Guy Wolf and Kevin R. Moon and Jake Slater Rhodes},
  title = {{Random Forest Autoencoders for Guided Representation Learning}},
  booktitle = {Advances in Neural Information Processing Systems},
  year = {2025},
  url = {https://openreview.net/forum?id=NjxW4m6KdH},
}
Figure