ComputeSimilarity: Compute Similarities

Description Usage Arguments Value Examples

View source: R/ComputeSimilarity.R

Description

Computes pairwise similarities between observations. The similarity between two points is defined as the fraction of trees such that two points fall into the same leaf node.

Usage

1
ComputeSimilarity(X, forest, num.cores = 0L, Xtrain = NULL)

Arguments

X

an n sample by d feature matrix (preferable) or data frame which was used to train the provided forest.

forest

a forest trained using the rerf function, with COOB=TRUE.

num.cores

the number of cores to use while training. If num.cores=0 then 1 less than the number of cores reported by the OS are used. (num.cores=0)

Xtrain

an n by d numeric matrix (preferable) or data frame. This should be the same data matrix/frame used to train the forest, and is only required if RerF was called with rank.transform = TRUE. (Xtrain=NULL)

Value

similarity a normalized n by n matrix of pairwise similarities

Examples

1
2
3
4
5
library(rerf)
X <- as.matrix(iris[, 1:4])
Y <- iris[[5L]]
forest <- RerF(X, Y, num.cores = 1L)
sim.matrix <- ComputeSimilarity(X, forest, num.cores = 1L)

rerf documentation built on May 2, 2019, 8:16 a.m.