CaseBasedReasoning (version 0.1)

proximityMatrix: Get proximity matrix of an ranger object

Description

Get proximity matrix of an ranger object

Usage

proximityMatrix(x, y = NULL, rfObject)

Arguments

x

a new dataset

y

a second new dataset (Default: NULL)

rfObject

ranger object

Value

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

Examples

Run this code
# NOT RUN {
require(ranger)
rf <- ranger(Species ~ ., data = iris, num.trees = 5, write.forest = TRUE)
d <- proximityMatrix(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)
d <- proximityMatrix(x = iris[learn, -5], y = iris[test, -5], rfObject = rf)

# }

Run the code above in your browser using DataCamp Workspace