compute_fit_metric: Computes fit metric between two trees

View source: R/compute_metrics.R

compute_fit_metricR Documentation

Computes fit metric between two trees

Description

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

Usage

compute_fit_metric(rf, data)

Arguments

rf

randomForest object from which to compute distances between trees

data

data frame with predictor variables used to fit the model (does not need to be the training data)

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
  )

# Compute fit metrics between all trees
compute_fit_metric(penguin_rf, penguins)

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