Learn R Programming

edarf (version 1.1.0)

extract_proximity: Methods to extract proximity matrices from random forests

Description

Extracts proximity matrices from random forest objects from the party, randomForest, randomForestSRC, or ranger packages

Usage

extract_proximity(fit, newdata)

Arguments

fit
object of class 'RandomForest', 'randomForest', 'rfsrc', or `ranger`
newdata
new data with the same columns as the data used for fit
...
arguments to be passed to extract_proximity

Value

an n x n matrix where position i, j gives the proportion of times observation i and j are in the same teriminal node across all trees

See Also

plot_prox for plotting principal components of proximity matrices.

Examples

Run this code
library(randomForest)

fit <- randomForest(hp ~ ., mtcars, proximity = TRUE)
extract_proximity(fit)

fit <- randomForest(Species ~ ., iris, proximity = TRUE)
extract_proximity(fit)

Run the code above in your browser using DataLab