diff --git a/R-package/NAMESPACE b/R-package/NAMESPACE index 1e6031c9f..e4784bbf5 100644 --- a/R-package/NAMESPACE +++ b/R-package/NAMESPACE @@ -16,3 +16,6 @@ exportMethods(predict) import(methods) importClassesFrom(Matrix,dgCMatrix) importClassesFrom(Matrix,dgeMatrix) +importFrom(data.table,":=") +importFrom(data.table,data.table) +importFrom(magrittr,"%>%") diff --git a/R-package/man/agaricus.test.Rd b/R-package/man/agaricus.test.Rd index 3cf87c9f8..8fee4e2ee 100644 --- a/R-package/man/agaricus.test.Rd +++ b/R-package/man/agaricus.test.Rd @@ -1,4 +1,5 @@ -% Generated by roxygen2 (4.0.1): do not edit by hand +% Generated by roxygen2 (4.1.0): do not edit by hand +% Please edit documentation in R/xgboost.R \docType{data} \name{agaricus.test} \alias{agaricus.test} diff --git a/R-package/man/agaricus.train.Rd b/R-package/man/agaricus.train.Rd index dd9f6e9a3..02b55423a 100644 --- a/R-package/man/agaricus.train.Rd +++ b/R-package/man/agaricus.train.Rd @@ -1,4 +1,5 @@ -% Generated by roxygen2 (4.0.1): do not edit by hand +% Generated by roxygen2 (4.1.0): do not edit by hand +% Please edit documentation in R/xgboost.R \docType{data} \name{agaricus.train} \alias{agaricus.train} diff --git a/R-package/man/getinfo.Rd b/R-package/man/getinfo.Rd index 23e3adc84..37e0ad0be 100644 --- a/R-package/man/getinfo.Rd +++ b/R-package/man/getinfo.Rd @@ -1,4 +1,5 @@ -% Generated by roxygen2 (4.0.1): do not edit by hand +% Generated by roxygen2 (4.1.0): do not edit by hand +% Please edit documentation in R/getinfo.xgb.DMatrix.R \docType{methods} \name{getinfo} \alias{getinfo} @@ -12,9 +13,9 @@ getinfo(object, ...) \arguments{ \item{object}{Object of class "xgb.DMatrix"} -\item{name}{the name of the field to get} - \item{...}{other parameters} + +\item{name}{the name of the field to get} } \description{ Get information of an xgb.DMatrix object diff --git a/R-package/man/predict-xgb.Booster-method.Rd b/R-package/man/predict-xgb.Booster-method.Rd index 36d6327b1..afa0c70a5 100644 --- a/R-package/man/predict-xgb.Booster-method.Rd +++ b/R-package/man/predict-xgb.Booster-method.Rd @@ -1,11 +1,12 @@ -% Generated by roxygen2 (4.0.1): do not edit by hand +% Generated by roxygen2 (4.1.0): do not edit by hand +% Please edit documentation in R/predict.xgb.Booster.R \docType{methods} \name{predict,xgb.Booster-method} \alias{predict,xgb.Booster-method} \title{Predict method for eXtreme Gradient Boosting model} \usage{ -\S4method{predict}{xgb.Booster}(object, newdata, outputmargin = FALSE, - ntreelimit = NULL) +\S4method{predict}{xgb.Booster}(object, newdata, missing = NULL, + outputmargin = FALSE, ntreelimit = NULL) } \arguments{ \item{object}{Object of class "xgb.Boost"} diff --git a/R-package/man/setinfo.Rd b/R-package/man/setinfo.Rd index 7ea992110..4ed262b46 100644 --- a/R-package/man/setinfo.Rd +++ b/R-package/man/setinfo.Rd @@ -1,4 +1,5 @@ -% Generated by roxygen2 (4.0.1): do not edit by hand +% Generated by roxygen2 (4.1.0): do not edit by hand +% Please edit documentation in R/setinfo.xgb.DMatrix.R \docType{methods} \name{setinfo} \alias{setinfo} @@ -12,11 +13,11 @@ setinfo(object, ...) \arguments{ \item{object}{Object of class "xgb.DMatrix"} +\item{...}{other parameters} + \item{name}{the name of the field to get} \item{info}{the specific field of information to set} - -\item{...}{other parameters} } \description{ Set information of an xgb.DMatrix object diff --git a/R-package/man/slice.Rd b/R-package/man/slice.Rd index a749aa8ff..a7812e886 100644 --- a/R-package/man/slice.Rd +++ b/R-package/man/slice.Rd @@ -1,4 +1,5 @@ -% Generated by roxygen2 (4.0.1): do not edit by hand +% Generated by roxygen2 (4.1.0): do not edit by hand +% Please edit documentation in R/slice.xgb.DMatrix.R \docType{methods} \name{slice} \alias{slice} @@ -13,9 +14,9 @@ slice(object, ...) \arguments{ \item{object}{Object of class "xgb.DMatrix"} -\item{idxset}{a integer vector of indices of rows needed} - \item{...}{other parameters} + +\item{idxset}{a integer vector of indices of rows needed} } \description{ Get a new DMatrix containing the specified rows of diff --git a/R-package/man/xgb.DMatrix.Rd b/R-package/man/xgb.DMatrix.Rd index 227fb515f..86000220f 100644 --- a/R-package/man/xgb.DMatrix.Rd +++ b/R-package/man/xgb.DMatrix.Rd @@ -1,4 +1,5 @@ -% Generated by roxygen2 (4.0.1): do not edit by hand +% Generated by roxygen2 (4.1.0): do not edit by hand +% Please edit documentation in R/xgb.DMatrix.R \name{xgb.DMatrix} \alias{xgb.DMatrix} \title{Contruct xgb.DMatrix object} diff --git a/R-package/man/xgb.DMatrix.save.Rd b/R-package/man/xgb.DMatrix.save.Rd index 803de912b..6bbc277b3 100644 --- a/R-package/man/xgb.DMatrix.save.Rd +++ b/R-package/man/xgb.DMatrix.save.Rd @@ -1,4 +1,5 @@ -% Generated by roxygen2 (4.0.1): do not edit by hand +% Generated by roxygen2 (4.1.0): do not edit by hand +% Please edit documentation in R/xgb.DMatrix.save.R \name{xgb.DMatrix.save} \alias{xgb.DMatrix.save} \title{Save xgb.DMatrix object to binary file} diff --git a/R-package/man/xgb.cv.Rd b/R-package/man/xgb.cv.Rd index 050d8c4f8..b9c600c0e 100644 --- a/R-package/man/xgb.cv.Rd +++ b/R-package/man/xgb.cv.Rd @@ -1,10 +1,12 @@ -% Generated by roxygen2 (4.0.1): do not edit by hand +% Generated by roxygen2 (4.1.0): do not edit by hand +% Please edit documentation in R/xgb.cv.R \name{xgb.cv} \alias{xgb.cv} \title{Cross Validation} \usage{ -xgb.cv(params = list(), data, nrounds, nfold, label = NULL, showsd = TRUE, - metrics = list(), obj = NULL, feval = NULL, ...) +xgb.cv(params = list(), data, nrounds, nfold, label = NULL, + missing = NULL, showsd = TRUE, metrics = list(), obj = NULL, + feval = NULL, ...) } \arguments{ \item{params}{the list of parameters. Commonly used ones are: diff --git a/R-package/man/xgb.dump.Rd b/R-package/man/xgb.dump.Rd index 9571855ff..9be2696b9 100644 --- a/R-package/man/xgb.dump.Rd +++ b/R-package/man/xgb.dump.Rd @@ -1,4 +1,5 @@ -% Generated by roxygen2 (4.0.1): do not edit by hand +% Generated by roxygen2 (4.1.0): do not edit by hand +% Please edit documentation in R/xgb.dump.R \name{xgb.dump} \alias{xgb.dump} \title{Save xgboost model to text file} diff --git a/R-package/man/xgb.importance.Rd b/R-package/man/xgb.importance.Rd new file mode 100644 index 000000000..9609fe82f --- /dev/null +++ b/R-package/man/xgb.importance.Rd @@ -0,0 +1,33 @@ +% Generated by roxygen2 (4.1.0): do not edit by hand +% Please edit documentation in R/xgb.importance.R +\name{xgb.importance} +\alias{xgb.importance} +\title{Show importance of features in a model} +\usage{ +xgb.importance(feature_names, filename_dump) +} +\arguments{ +\item{feature_names}{names of each feature as a character vector. Can be extracted from a sparse matrix.} + +\item{filename_dump}{the name of the text file.} +} +\description{ +Read a xgboost model in text file format. Return a data.table of the features with their weight. +} +\examples{ +data(agaricus.train, package='xgboost') +data(agaricus.test, package='xgboost') + +#Both dataset are list with two items, a sparse matrix and labels (outcome column which will be learned). +#Each column of the sparse Matrix is a feature in one hot encoding format. +train <- agaricus.train +test <- agaricus.test + +bst <- xgboost(data = train$data, label = train$label, max.depth = 2, + eta = 1, nround = 2,objective = "binary:logistic") +xgb.dump(bst, 'xgb.model.dump') + +#agaricus.test$data@Dimnames[[2]] represents the column name of the sparse matrix. +xgb.importance(agaricus.test$data@Dimnames[[2]], 'xgb.model.dump') +} + diff --git a/R-package/man/xgb.load.Rd b/R-package/man/xgb.load.Rd index d2c5d94b6..433b38c79 100644 --- a/R-package/man/xgb.load.Rd +++ b/R-package/man/xgb.load.Rd @@ -1,4 +1,5 @@ -% Generated by roxygen2 (4.0.1): do not edit by hand +% Generated by roxygen2 (4.1.0): do not edit by hand +% Please edit documentation in R/xgb.load.R \name{xgb.load} \alias{xgb.load} \title{Load xgboost model from binary file} diff --git a/R-package/man/xgb.save.Rd b/R-package/man/xgb.save.Rd index 0ccdf13da..ded444446 100644 --- a/R-package/man/xgb.save.Rd +++ b/R-package/man/xgb.save.Rd @@ -1,4 +1,5 @@ -% Generated by roxygen2 (4.0.1): do not edit by hand +% Generated by roxygen2 (4.1.0): do not edit by hand +% Please edit documentation in R/xgb.save.R \name{xgb.save} \alias{xgb.save} \title{Save xgboost model to binary file} diff --git a/R-package/man/xgb.train.Rd b/R-package/man/xgb.train.Rd index a05e2eeb9..58ef94135 100644 --- a/R-package/man/xgb.train.Rd +++ b/R-package/man/xgb.train.Rd @@ -1,4 +1,5 @@ -% Generated by roxygen2 (4.0.1): do not edit by hand +% Generated by roxygen2 (4.1.0): do not edit by hand +% Please edit documentation in R/xgb.train.R \name{xgb.train} \alias{xgb.train} \title{eXtreme Gradient Boosting Training} diff --git a/R-package/man/xgboost.Rd b/R-package/man/xgboost.Rd index d5abe927d..d85ee6d4a 100644 --- a/R-package/man/xgboost.Rd +++ b/R-package/man/xgboost.Rd @@ -1,10 +1,11 @@ -% Generated by roxygen2 (4.0.1): do not edit by hand +% Generated by roxygen2 (4.1.0): do not edit by hand +% Please edit documentation in R/xgboost.R \name{xgboost} \alias{xgboost} \title{eXtreme Gradient Boosting (Tree) library} \usage{ -xgboost(data = NULL, label = NULL, params = list(), nrounds, - verbose = 1, ...) +xgboost(data = NULL, label = NULL, missing = NULL, params = list(), + nrounds, verbose = 1, ...) } \arguments{ \item{data}{takes \code{matrix}, \code{dgCMatrix}, local data file or