Compute proximity matrix from a random forest or matrix of terminal node assignments (one row for each observation and one column for each tree in the forest).
proximity(x, ...)# S3 method for default
proximity(x, sparse = NULL, upper = TRUE, ...)
# S3 method for matrix
proximity(x, sparse = NULL, upper = TRUE, ...)
# S3 method for ranger
proximity(x, data = NULL, sparse = NULL, upper = TRUE, ...)
A matrix or sparse Matrix (sparse = TRUE
) of pairwise
proximity (i.e., similarity) scores between training observations.
Either a ranger
object or a matrix of terminal
node assignments (one row for each observation and one column for each tree
in the forest).
Additional optional argument. (Currently ignored.)
Logical or NULL
indicating whether or not the resulting
matrix should be sparse. If NULL
(the default) it is made sparse when
more than half the entries are 0.
Logical indicating whether or not to return the proximities in
upper triangular form (TRUE
) or as a symmetric matrix (FALSE
).
Default is TRUE
.
Optional data frame passed on to
predict.ranger
. It's a good idea to pass the data via
this argument whenever x
is a ranger
object. If
NULL
(the default) it will be looked for recursively.