compute_covariate_metric: Computes metric comparing covariates from two trees

View source: R/compute_metrics.R

compute_covariate_metricR Documentation

Computes metric comparing covariates from two trees

Description

Function for computing the fit metric from \insertCitebanerjee:2012;textualTreeTracer.

Usage

compute_covariate_metric(rf, max_depth = NULL)

Arguments

rf

randomForest object from which to compute distances between trees

max_depth

an option to set the maximum tree depth to consider when comparing trees (set to NULL by default)

References

\insertRef

banerjee:2012TreeTracer

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 = 5
  )

# Compute fit metrics between all trees
compute_covariate_metric(penguin_rf)

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