add style option

This commit is contained in:
El Potaeto
2015-01-07 17:05:34 +01:00
parent 9e20893d35
commit cce26756bf
2 changed files with 18 additions and 9 deletions

View File

@@ -5,7 +5,7 @@
\title{Plot a boosted tree model}
\usage{
xgb.plot.tree(feature_names = NULL, filename_dump = NULL,
n_first_tree = NULL)
n_first_tree = NULL, styles = NULL)
}
\arguments{
\item{feature_names}{names of each feature as a character vector. Can be extracted from a sparse matrix (see example). If model dump already contains feature names, this argument should be \code{NULL}.}
@@ -13,6 +13,8 @@ xgb.plot.tree(feature_names = NULL, filename_dump = NULL,
\item{filename_dump}{the path to the text file storing the model. Model dump must include the gain per feature and per tree (parameter \code{with.stats = T} in function \code{xgb.dump}).}
\item{n_first_tree}{limit the plot to the n first trees. If \code{NULL}, all trees of the model are plotted. Performance can be low for huge models.}
\item{style}{a \code{character} vector storing a css style to customize the appearance of nodes. Look at the \href{https://github.com/knsv/mermaid/wiki}{Mermaid wiki} for more information.}
}
\value{
A \code{data.table} of the features used in the model with their average gain (and their weight for boosted tree model) in the model.
@@ -25,9 +27,9 @@ Only works for boosted tree model (not linear model).
The content of each node is organised that way:
\itemize{
\item{\code{feature} value}{ ;}
\item{\code{cover}}{: the sum of second order gradient of training data classified to the leaf, if it is square loss, this simply corresponds to the number of instances in that branch. Deeper in the tree a node is, lower this metric will be ;}
\item{\code{gain}}{: metric the importance of the node in the model.}
\item \code{feature} value ;
\item \code{cover}: the sum of second order gradient of training data classified to the leaf, if it is square loss, this simply corresponds to the number of instances in that branch. Deeper in the tree a node is, lower this metric will be ;
\item \code{gain}: metric the importance of the node in the model.
}
Each branch finished with a leaf. For each leaf, only the \code{cover} is indicated.