tree_to_text: Get latex code in the format of the package "forest" for the...

View source: R/tree_to_text.R

tree_to_textR Documentation

Get latex code in the format of the package "forest" for the plot of the decision tree

Description

Get latex code in the format of the package "forest" for the plot of the decision tree

Usage

tree_to_text(
  node_id,
  tree_info_df,
  train_data_df,
  test_data_df,
  rf_list,
  tree_number,
  dependent_var,
  show_sample_size,
  show_prediction_nodes,
  show_uncertainty,
  show_coverage,
  show_intervalwidth,
  vert_sep,
  hor_sep,
  colors
)

Arguments

node_id

Node ID of the node whose parent ID is to be determined

tree_info_df

Data frame containing information about the structure of the decision tree, which is built like a "treeInfo()" data frame from the package "ranger"

train_data_df

Data frame of the training data with which the random forest was trained

test_data_df

Data frame of the test data (only needed, if show_coverage = TRUE)

rf_list

Random forest, which is built like the one you get from ranger()

tree_number

Number of the decision tree of the rf_list to be displayed

dependent_var

Name of the column of the dependent variable in training data

show_sample_size

Option to display percentage of observations that reach nodes during training (TRUE or FALSE)

show_prediction_nodes

Option to display prediction in all nodes (TRUE or FALSE)

show_uncertainty

Option to display uncertainty quantification in terminal nodes (for now only available for regression)

show_coverage

Option to display marginal coverage (only in combination with show_uncertainty = TRUE)

show_intervalwidth

Option to display interval width uncertainty quantification in terminal nodes (only in combination with show_uncertainty = TRUE)

vert_sep

Vertical spacing of nodes in mm (parameter from Latex package "forest")

hor_sep

Horizontal spacing of nodes in mm (parameter from Latex package "forest")

Value

Character pasted Latex code for the plot with the Latex package "forest"

Author(s)

Lea Louisa Kronziel, M.Sc.


imbs-hl/timbR documentation built on April 17, 2025, 2:08 p.m.