View source: R/compute_metrics.R
compute_partition_metric | R Documentation |
Function for computing the partition metric from \insertCitechipman:1998;textualTreeTracer.
compute_partition_metric(rf, tree_preds)
rf |
randomForest object from which to compute distances between trees |
tree_preds |
output from the function get_tree_preds |
chipman:1998TreeTracer
# 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)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.