proximityMatrix: Get proximity matrix of an ranger object

Description Usage Arguments Value Examples

View source: R/distance.R

Description

Get proximity matrix of an ranger object

Usage

1
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

1
2
3
4
5
6
7
8
9
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)

CaseBasedReasoning documentation built on June 12, 2018, 5:18 p.m.