proximity: Proximity matrix

View source: R/proximity.R

proximityR Documentation

Proximity matrix

Description

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).

Usage

proximity(x, ...)

## Default S3 method:
proximity(x, sparse = NULL, upper = TRUE, ...)

## S3 method for class 'matrix'
proximity(x, sparse = NULL, upper = TRUE, ...)

## S3 method for class 'ranger'
proximity(x, data = NULL, sparse = NULL, upper = TRUE, ...)

Arguments

x

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.)

sparse

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.

upper

Logical indicating whether or not to return the proximities in upper triangular form (TRUE) or as a symmetric matrix (FALSE). Default is TRUE.

data

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.

Value

A matrix or sparse Matrix (sparse = TRUE) of pairwise proximity (i.e., similarity) scores between training observations.


bgreenwell/treemisc documentation built on Oct. 26, 2022, 12:56 a.m.