proximity_distance {CaseBasedReasoning}R Documentation

Get proximity matrix of an ranger object

Description

Get proximity matrix of an ranger object

Usage

proximity_distance(x, y = NULL, rfObject, as_dist = TRUE)

Arguments

x

a new dataset

y

a second new dataset (Default: NULL)

rfObject

ranger object

as_dist

Bool, return a dist object.

Value

a dist or a matrix object with pairwise proximity of observations in x vs y (if not null)

Examples


require(ranger)
rf <- ranger(Species ~ ., data = iris, num.trees = 5, write.forest = TRUE)
proximity_distance(x = iris[, -5], rfObject = rf)

set.seed(1234L)
learn <- sample(1:150, 100)
test <- (1:150)[-learn]
rf <- ranger(Species ~ ., data = iris[learn, ], num.trees = 500, write.forest = TRUE)
proximity_distance(x = iris[learn, -5], y = iris[test, -5], rfObject = rf)


[Package CaseBasedReasoning version 0.3 Index]