How can a Random Forest proximity matrix be used for unsupervised clustering?

Last updated 5 November 2026

  • Proximity is the fraction of trees where two samples share a leaf, and 1 − proximity serves as a learned distance.

  • Breiman's trick: train an RF to separate real rows from synthetic rows (each feature sampled independently from its marginal). Then compute proximities on real rows and cluster with PAM, hierarchical, or spectral methods on the precomputed distances.

  • It handles mixed data, needs no scaling, and ignores irrelevant features. However, it costs O(n²) memory and depends on the synthetic reference and leaf size.

  • https://github.com/nguforche/UnsupRF
  • https://arxiv.org/html/2507.19455v1
  • https://www.analyticsvidhya.com/blog/2021/05/bagging-25-questions-to-test-your-skills-on-random-forest-algorithm/
All Random Forests interview questions