Skip to content

Commit 5a49eb0

Browse files
Merge pull request dmlc#682 from pommedeterresautee/master
Wording #Rstat
2 parents 2d2f926 + 1b07f86 commit 5a49eb0

File tree

8 files changed

+24
-40
lines changed

8 files changed

+24
-40
lines changed

R-package/R/xgb.importance.R

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,17 +10,15 @@
1010
#' @importFrom Matrix cBind
1111
#' @importFrom Matrix sparseVector
1212
#'
13-
#' @param 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}.
14-
#' @param model generated by the \code{xgb.train} function. Avoid the creation of a dump file.
13+
#' @param 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}.
14+
#' @param model generated by the \code{xgb.train} function.
1515
#' @param data the dataset used for the training step. Will be used with \code{label} parameter for co-occurence computation. More information in \code{Detail} part. This parameter is optional.
1616
#' @param label the label vetor used for the training step. Will be used with \code{data} parameter for co-occurence computation. More information in \code{Detail} part. This parameter is optional.
1717
#' @param target a function which returns \code{TRUE} or \code{1} when an observation should be count as a co-occurence and \code{FALSE} or \code{0} otherwise. Default function is provided for computing co-occurences in a binary classification. The \code{target} function should have only one parameter. This parameter will be used to provide each important feature vector after having applied the split condition, therefore these vector will be only made of 0 and 1 only, whatever was the information before. More information in \code{Detail} part. This parameter is optional.
1818
#'
1919
#' @return 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.
2020
#'
2121
#' @details
22-
#' This is the function to understand the model trained (and through your model, your data).
23-
#'
2422
#' This function is for both linear and tree models.
2523
#'
2624
#' \code{data.table} is returned by the function.

R-package/R/xgb.plot.deepness.R

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ get.paths.to.leaf <- function(dt.tree) {
6969
#' @importFrom data.table setnames
7070
#' @importFrom data.table :=
7171
#' @importFrom magrittr %>%
72-
#' @param model dump generated by the \code{xgb.train} function. Avoid the creation of a dump file.
72+
#' @param model dump generated by the \code{xgb.train} function.
7373
#'
7474
#' @return Two graphs showing the distribution of the model deepness.
7575
#'
@@ -86,7 +86,7 @@ get.paths.to.leaf <- function(dt.tree) {
8686
#'
8787
#' \itemize{
8888
#' \item Count: number of leaf per level of deepness;
89-
#' \item Weighted cover: noramlized weighted cover per Leaf (weighted number of instances).
89+
#' \item Weighted cover: noramlized weighted cover per leaf (weighted number of instances).
9090
#' }
9191
#'
9292
#' This function is inspired by the blog post \url{http://aysent.github.io/2015/11/08/random-forest-leaf-visualization.html}

R-package/R/xgb.plot.multi.trees.R

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@
1010
#' @importFrom stringr str_detect
1111
#' @importFrom stringr str_extract
1212
#'
13-
#' @param model dump generated by the \code{xgb.train} function. Avoid the creation of a dump file.
14-
#' @param 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+
#' @param model dump generated by the \code{xgb.train} function.
14+
#' @param 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}.
1515
#' @param features.keep number of features to keep in each position of the multi trees.
1616
#' @param plot.width width in pixels of the graph to produce
1717
#' @param plot.height height in pixels of the graph to produce

R-package/R/xgb.plot.tree.R

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,11 @@
11
#' Plot a boosted tree model
22
#'
3-
#' Read a tree model text dump.
4-
#' Plotting only works for boosted tree model (not linear model).
3+
#' Read a tree model text dump and plot the model.
54
#'
65
#' @importFrom data.table data.table
76
#' @importFrom data.table :=
87
#' @importFrom magrittr %>%
9-
#' @param 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}.
8+
#' @param 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}.
109
#' @param model generated by the \code{xgb.train} function. Avoid the creation of a dump file.
1110
#' @param 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.
1211
#' @param plot.width the width of the diagram in pixels.
@@ -19,25 +18,20 @@
1918
#' The content of each node is organised that way:
2019
#'
2120
#' \itemize{
22-
#' \item \code{feature} value ;
23-
#' \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 ;
21+
#' \item \code{feature} value;
22+
#' \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;
2423
#' \item \code{gain}: metric the importance of the node in the model.
2524
#' }
2625
#'
27-
#' Each branch finishes with a leaf. For each leaf, only the \code{cover} is indicated.
28-
#' It uses \href{http://www.graphviz.org/}{GraphViz} library for that purpose.
26+
#' The function uses \href{http://www.graphviz.org/}{GraphViz} library for that purpose.
2927
#'
3028
#' @examples
3129
#' data(agaricus.train, package='xgboost')
3230
#'
33-
#' #Both dataset are list with two items, a sparse matrix and labels
34-
#' #(labels = outcome column which will be learned).
35-
#' #Each column of the sparse Matrix is a feature in one hot encoding format.
36-
#'
3731
#' bst <- xgboost(data = agaricus.train$data, label = agaricus.train$label, max.depth = 2,
3832
#' eta = 1, nthread = 2, nround = 2,objective = "binary:logistic")
3933
#'
40-
#' #agaricus.test$data@@Dimnames[[2]] represents the column names of the sparse matrix.
34+
#' # agaricus.train$data@@Dimnames[[2]] represents the column names of the sparse matrix.
4135
#' xgb.plot.tree(feature_names = agaricus.train$data@@Dimnames[[2]], model = bst)
4236
#'
4337
#' @export

R-package/man/xgb.importance.Rd

Lines changed: 2 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

R-package/man/xgb.plot.deepness.Rd

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

R-package/man/xgb.plot.multi.trees.Rd

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

R-package/man/xgb.plot.tree.Rd

Lines changed: 6 additions & 12 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)