pranger: Pranger

View source: R/pranger.R

prangerR Documentation

Pranger

Description

Pranger bases on unsupervised random forests generated with ranger to compute proximities between individuals.Two approaches are supported. The first approach of Shi and Horvath (2006) that increases the dissimilarity between two individuals to one if they don't belong to the same terminal node. The second approach of Fouodo et al. (2021) takes the tree depth into account and estimates the dissimilarity between two individuals basing on the length of the minimal path between the terminal nodes they belong to.

Usage

pranger(
  data,
  strategy,
  oob = FALSE,
  init_dist = 0,
  nb_bootst = NULL,
  approach = "deep",
  aggregation = mean,
  verbose = FALSE,
  seed = NULL,
  ...
)

Arguments

data

[data.frame] A data.frame of original dataset

strategy

[character] Name of the resampling strategy to be used. Most be element of "boostrepl", "boostwithoutrepl", "boostbayes", "unif", "normal", "binomial" or "boostaggr"

oob

[boolean] If TRUE, dissimilarities are computed using out of bag observations only.

init_dist

[integer] Initial distance between in-of-bag individual. Required if oob = TRUE.

nb_bootst

[integer] Number of repetitions required to aggregate the bootstrap samples. Set to ceiling(sqrt(n)) if not provided, with n the number of observations

approach

[character] One of "shi" or "deep". If "shi", then the approach of Shi and Hovarth (2006) is called to compute dissimilarities. Else, if "deep" the approach of Fouodo et al. (2021) is called.

aggregation

[function] Aggregation function in the case of "boostaggr". Default is the mean function. You can pass your on aggregation function

verbose

[boolean] If TRUE, verbose

seed

[integer] Seed

...

further parameters to be passed to ranger

Value

[matrix] Matrix of dissimilarities. Note: You can use the function cleandist to convert the dissimilarity matrix into a distance matrix

Author(s)

Cesaire J. K. Fouodo

Examples

## Not run: 
set.seed(1234)
index <- sample(x = 1:150, size = 15, replace = FALSE)
  iris_dissimilarities <- pranger(
                             data = iris[ , -5],
                             strategy = "boostrepl")

## End(Not run)

imbs-hl/pranger documentation built on May 15, 2022, 5:27 p.m.