Plot XGBoost tree visualization
Arguments
- model
A tidylearn XGBoost model object
- tree_index
Index of the tree to plot, counting the first tree as 0 (default: 0). A multiclass model grows one tree per class in each round.
- ...
Additional arguments passed to
xgboost::xgb.plot.tree()
Value
The return value of xgb.plot.tree, a
tree diagram rendered via the DiagrammeR package.
Examples
# \donttest{
if (requireNamespace("xgboost", quietly = TRUE) &&
requireNamespace("DiagrammeR", quietly = TRUE)) {
model <- tl_model(iris, Species ~ ., method = "xgboost", nrounds = 10,
nthread = 2)
# tree_index is zero-based, so this is the first tree
tl_plot_xgboost_tree(model, tree_index = 0)
}
# }
