[R] xgb.plot.tree fixes (#1939)
* [R] a few fixes and improvements to xgb.plot.tree * [R] deprecate n_first_tree replace with trees; fix types in xgb.model.dt.tree
This commit is contained in:
committed by
Tianqi Chen
parent
d23ea5ca7d
commit
d7406e07f3
@@ -8,9 +8,9 @@ xgb.plot.multi.trees(model, feature_names = NULL, features_keep = 5,
|
||||
plot_width = NULL, plot_height = NULL, ...)
|
||||
}
|
||||
\arguments{
|
||||
\item{model}{dump generated by the \code{xgb.train} function.}
|
||||
\item{model}{produced by the \code{xgb.train} function.}
|
||||
|
||||
\item{feature_names}{names of each feature as a \code{character} vector. Can be extracted from a sparse matrix (see example). If model dump already contains feature names, this argument should be \code{NULL}.}
|
||||
\item{feature_names}{names of each feature as a \code{character} vector.}
|
||||
|
||||
\item{features_keep}{number of features to keep in each position of the multi trees.}
|
||||
|
||||
@@ -27,21 +27,19 @@ Two graphs showing the distribution of the model deepness.
|
||||
Visualization of the ensemble of trees as a single collective unit.
|
||||
}
|
||||
\details{
|
||||
This function tries to capture the complexity of gradient boosted tree ensemble
|
||||
in a cohesive way.
|
||||
This function tries to capture the complexity of a gradient boosted tree model
|
||||
in a cohesive way by compressing an ensemble of trees into a single tree-graph representation.
|
||||
The goal is to improve the interpretability of a model generally seen as black box.
|
||||
|
||||
The goal is to improve the interpretability of the model generally seen as black box.
|
||||
The function is dedicated to boosting applied to decision trees only.
|
||||
|
||||
The purpose is to move from an ensemble of trees to a single tree only.
|
||||
Note: this function is applicable to tree booster-based models only.
|
||||
|
||||
It takes advantage of the fact that the shape of a binary tree is only defined by
|
||||
its deepness (therefore in a boosting model, all trees have the same shape).
|
||||
its depth (therefore, in a boosting model, all trees have similar shape).
|
||||
|
||||
Moreover, the trees tend to reuse the same features.
|
||||
|
||||
The function will project each tree on one, and keep for each position the
|
||||
\code{features_keep} first features (based on Gain per feature measure).
|
||||
The function projects each tree onto one, and keeps for each position the
|
||||
\code{features_keep} first features (based on the Gain per feature measure).
|
||||
|
||||
This function is inspired by this blog post:
|
||||
\url{https://wellecks.wordpress.com/2015/02/21/peering-into-the-black-box-visualizing-lambdamart/}
|
||||
|
||||
Reference in New Issue
Block a user