compute_partition_metric: Computes partition metric between two trees

View source: R/compute_metrics.R

compute_partition_metricR Documentation

Computes partition metric between two trees

Description

Function for computing the partition metric from \insertCitechipman:1998;textualTreeTracer.

Usage

compute_partition_metric(rf, tree_preds)

Arguments

rf

randomForest object from which to compute distances between trees

tree_preds

output from the function get_tree_preds

References

\insertRef

chipman:1998TreeTracer

Examples


# Load packages
library(palmerpenguins)

# Load the Palmer penguins data
penguins <- na.omit(penguins)

# Fit a random forest
set.seed(71)
penguin_rf <-
  randomForest::randomForest(
    species ~ bill_length_mm + bill_depth_mm + flipper_length_mm + body_mass_g,
    data = penguins,
    ntree = 10
  )

# Predictions from all trees for five observations
tree_preds <- get_tree_preds(data = penguins[1:5,], rf = penguin_rf)

# Compute fit metrics between all trees
compute_partition_metric(penguin_rf, tree_preds)

goodekat/TreeTracer documentation built on April 19, 2023, 7:44 p.m.