Fits a partykit::cforest and visualizes one of its individual trees
using the full dtGAP pipeline (decision tree + heatmap + evaluation).
rf_dtGAP(
x = NULL,
target_lab = NULL,
show = c("all", "train", "test"),
tree_index = 1L,
ntree = 500L,
mtry = NULL,
rf_control = NULL,
data_train = NULL,
data_test = NULL,
data_all = NULL,
test_size = 0.3,
task = c("classification", "regression"),
trans_type = c("normalize", "scale", "percentize", "none"),
col_proximity = c("pearson", "spearman", "kendall"),
linkage_method = c("CT", "SG", "CP"),
seriate_method = "TSP",
cRGAR_w = 5,
sort_by_data_type = TRUE,
custom_layout = NULL,
panel_space = 0.001,
margin = 20,
total_w = 297,
total_h = 210,
tree_p = 0.3,
include_var_imp = TRUE,
col_var_imp = "orange",
var_imp_bar_width = 0.8,
var_imp_fontsize = 5,
split_var_bg = "darkgreen",
split_var_fontsize = 5,
Col_Prox_palette = "RdBu",
Col_Prox_n_colors = 11,
label_map = NULL,
label_map_colors = NULL,
type_palette = "Dark2",
label_palette = "OrRd",
n_label_color = 9,
pred_ha_gap = unit(1, "mm"),
prop_palette = gray,
n_prop_colors = 11,
Row_Prox_palette = "Spectral",
Row_Prox_n_colors = 11,
row_border = TRUE,
row_gap = unit(1, "mm"),
sorted_dat_palette = "Blues",
sorted_dat_n_colors = 9,
show_row_names = TRUE,
row_names_gp = gpar(fontsize = 5),
show_row_prox = TRUE,
show_col_prox = TRUE,
raw_value_col = NULL,
lgd_direction = c("vertical", "horizontal"),
x_eval_start = 15,
y_eval_start = NULL,
eval_text = 7,
print_eval = TRUE,
simple_metrics = FALSE
)Draws the dtGAP visualization for the selected tree to the current graphics device. Called for its side effect; returns invisibly.
Character. Name or label of the dataset.
Character. Name of the target column.
Character. Which subset to show: "all", "train",
or "test".
Integer. Which tree to extract (1-based). Default is 1.
Integer. Number of trees in the forest (default 500).
Integer or NULL. Number of variables randomly sampled at each
split. If NULL, uses the cforest default.
A ctree_control object or NULL.
Data frame. Training data.
Data frame. Test data.
Data frame. Full dataset.
Numeric. Proportion for test split (default 0.3).
Character. "classification" or "regression".
Character. Transformation type.
Character. Correlation method.
Character. Linkage method.
Character. Seriation method.
Integer. Window size for RGAR.
Logical. Preserve data_type grouping.
Optional custom node positions.
Numeric. Vertical spacing.
Numeric. Margin in mm.
Numeric. Page width in mm.
Numeric. Page height in mm.
Numeric. Tree panel proportion.
Logical. Show importance barplot.
Color for importance bars.
Numeric. Bar width.
Numeric. Font size for importance.
Background for split variable names.
Font size for split variable names.
Palette for correlation heatmap.
Number of correlation colors.
Named vector for label mapping.
Named vector of mapped label colors.
Palette for data_type.
Palette for labels.
Number of label colors.
Gap between annotations.
Probability gradient palette.
Number of probability colors.
Palette for row proximity.
Number of row proximity colors.
Draw cell borders.
Gap between annotation blocks.
Palette for heatmap.
Number of heatmap colors.
Show row names.
Font settings for row names.
Show row proximity.
Show column proximity.
Colors for raw data values.
Legend direction.
Eval text x position.
Eval text y position.
Eval text font size.
Show evaluation results.
Use simple metrics.
# \donttest{
rf_dtGAP(
data_train = train_covid,
data_test = test_covid,
target_lab = "Outcome",
show = "test",
tree_index = 1,
ntree = 50,
print_eval = FALSE
)
# }
Run the code above in your browser using DataLab