View source: R/get_dist_matrix.R
get_dist_matrix | R Documentation |
The function converts the data frame of distances computed using compute_fit_metric to a matrix of distances between all trees. Helpful to use for clustering.
get_dist_matrix(fit_metrics)
fit_metrics |
output object from compute_fit_metric |
# 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
fit_metrics <- compute_fit_metric(penguin_rf, penguins)
# Obtain the distance matrix
get_dist_matrix(fit_metrics)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.