I came across the term proximity in random forests. But I couldn’t understand what it does in random forests. How does it help for classification purposes?

**Answer**

The term “proximity” means the “closeness” or “nearness” between pairs of cases.

Proximities are calculated for each pair of cases/observations/sample points. If two cases occupy the same terminal node through one tree, their proximity is increased by one. At the end of the run of all trees, the proximities are normalized by dividing by the number of trees. Proximities are used in replacing missing data, locating outliers, and producing illuminating low-dimensional views of the data.

**Proximities**

The proximities originally formed a NxN matrix. After a tree is grown, put all of the data, both training and oob, down the tree. If cases k and n are in the same terminal node increase their proximity by one. At the end, normalize the proximities by dividing by the number of trees.

Users noted that with large data sets, they could not fit an NxN matrix into fast memory. A modification reduced the required memory size to NxT where T is the number of trees in the forest. To speed up the computation-intensive scaling and iterative missing value replacement, the user is given the option of retaining only the nrnn largest proximities to each case.

When a test set is present, the proximities of each case in the test set with each case in the training set can also be computed. The amount of additional computing is moderate.

quote: https://www.stat.berkeley.edu/~breiman/RandomForests/cc_home.htm

**Attribution***Source : Link , Question Author : user3796494 , Answer Author : sinalpha*