documentation update
This commit is contained in:
parent
6901e90730
commit
d87cb24793
@ -7,6 +7,8 @@ setClass("xgb.Booster")
|
|||||||
#' @param object Object of class "xgb.Boost"
|
#' @param object Object of class "xgb.Boost"
|
||||||
#' @param newdata takes \code{matrix}, \code{dgCMatrix}, local data file or
|
#' @param newdata takes \code{matrix}, \code{dgCMatrix}, local data file or
|
||||||
#' \code{xgb.DMatrix}.
|
#' \code{xgb.DMatrix}.
|
||||||
|
#' @param missing Missing is only used when input is dense matrix, pick a float
|
||||||
|
# value that represents missing value. Sometime a data use 0 or other extreme value to represents missing values.
|
||||||
#' @param outputmargin whether the prediction should be shown in the original
|
#' @param outputmargin whether the prediction should be shown in the original
|
||||||
#' value of sum of functions, when outputmargin=TRUE, the prediction is
|
#' value of sum of functions, when outputmargin=TRUE, the prediction is
|
||||||
#' untransformed margin value. In logistic regression, outputmargin=T will
|
#' untransformed margin value. In logistic regression, outputmargin=T will
|
||||||
|
|||||||
@ -32,7 +32,7 @@
|
|||||||
#' @param nfold number of folds used
|
#' @param nfold number of folds used
|
||||||
#' @param label option field, when data is Matrix
|
#' @param label option field, when data is Matrix
|
||||||
#' @param missing Missing is only used when input is dense matrix, pick a float
|
#' @param missing Missing is only used when input is dense matrix, pick a float
|
||||||
#' value that represents missing value. Sometime a data use 0 or other extreme value to represents missing values.
|
# value that represents missing value. Sometime a data use 0 or other extreme value to represents missing values.
|
||||||
#' @param prediction A logical value indicating whether to return the prediction vector.
|
#' @param prediction A logical value indicating whether to return the prediction vector.
|
||||||
#' @param showsd \code{boolean}, whether show standard deviation of cross validation
|
#' @param showsd \code{boolean}, whether show standard deviation of cross validation
|
||||||
#' @param metrics, list of evaluation metrics to be used in corss validation,
|
#' @param metrics, list of evaluation metrics to be used in corss validation,
|
||||||
@ -50,8 +50,6 @@
|
|||||||
#' @param feval custimized evaluation function. Returns
|
#' @param feval custimized evaluation function. Returns
|
||||||
#' \code{list(metric='metric-name', value='metric-value')} with given
|
#' \code{list(metric='metric-name', value='metric-value')} with given
|
||||||
#' prediction and dtrain,
|
#' prediction and dtrain,
|
||||||
#' @param missing Missing is only used when input is dense matrix, pick a float
|
|
||||||
# value that represents missing value. Sometime a data use 0 or other extreme value to represents missing values.
|
|
||||||
#' @param verbose \code{boolean}, print the statistics during the process.
|
#' @param verbose \code{boolean}, print the statistics during the process.
|
||||||
#' @param ... other parameters to pass to \code{params}.
|
#' @param ... other parameters to pass to \code{params}.
|
||||||
#'
|
#'
|
||||||
|
|||||||
@ -33,7 +33,7 @@
|
|||||||
#' data(agaricus.test, package='xgboost')
|
#' data(agaricus.test, package='xgboost')
|
||||||
#'
|
#'
|
||||||
#' #Both dataset are list with two items, a sparse matrix and labels
|
#' #Both dataset are list with two items, a sparse matrix and labels
|
||||||
#' (labels = outcome column which will be learned).
|
#' #(labels = outcome column which will be learned).
|
||||||
#' #Each column of the sparse Matrix is a feature in one hot encoding format.
|
#' #Each column of the sparse Matrix is a feature in one hot encoding format.
|
||||||
#' train <- agaricus.train
|
#' train <- agaricus.train
|
||||||
#' test <- agaricus.test
|
#' test <- agaricus.test
|
||||||
|
|||||||
@ -43,7 +43,7 @@
|
|||||||
#' data(agaricus.train, package='xgboost')
|
#' data(agaricus.train, package='xgboost')
|
||||||
#'
|
#'
|
||||||
#' #Both dataset are list with two items, a sparse matrix and labels
|
#' #Both dataset are list with two items, a sparse matrix and labels
|
||||||
#' (labels = outcome column which will be learned).
|
#' #(labels = outcome column which will be learned).
|
||||||
#' #Each column of the sparse Matrix is a feature in one hot encoding format.
|
#' #Each column of the sparse Matrix is a feature in one hot encoding format.
|
||||||
#' train <- agaricus.train
|
#' train <- agaricus.train
|
||||||
#'
|
#'
|
||||||
|
|||||||
@ -43,7 +43,7 @@
|
|||||||
#' data(agaricus.train, package='xgboost')
|
#' data(agaricus.train, package='xgboost')
|
||||||
#'
|
#'
|
||||||
#' #Both dataset are list with two items, a sparse matrix and labels
|
#' #Both dataset are list with two items, a sparse matrix and labels
|
||||||
#' (labels = outcome column which will be learned).
|
#' #(labels = outcome column which will be learned).
|
||||||
#' #Each column of the sparse Matrix is a feature in one hot encoding format.
|
#' #Each column of the sparse Matrix is a feature in one hot encoding format.
|
||||||
#' train <- agaricus.train
|
#' train <- agaricus.train
|
||||||
#'
|
#'
|
||||||
|
|||||||
@ -6,7 +6,7 @@
|
|||||||
\title{Predict method for eXtreme Gradient Boosting model}
|
\title{Predict method for eXtreme Gradient Boosting model}
|
||||||
\usage{
|
\usage{
|
||||||
\S4method{predict}{xgb.Booster}(object, newdata, missing = NULL,
|
\S4method{predict}{xgb.Booster}(object, newdata, missing = NULL,
|
||||||
outputmargin = FALSE, ntreelimit = NULL)
|
outputmargin = FALSE, ntreelimit = NULL, predleaf = FALSE)
|
||||||
}
|
}
|
||||||
\arguments{
|
\arguments{
|
||||||
\item{object}{Object of class "xgb.Boost"}
|
\item{object}{Object of class "xgb.Boost"}
|
||||||
@ -14,6 +14,8 @@
|
|||||||
\item{newdata}{takes \code{matrix}, \code{dgCMatrix}, local data file or
|
\item{newdata}{takes \code{matrix}, \code{dgCMatrix}, local data file or
|
||||||
\code{xgb.DMatrix}.}
|
\code{xgb.DMatrix}.}
|
||||||
|
|
||||||
|
\item{missing}{Missing is only used when input is dense matrix, pick a float}
|
||||||
|
|
||||||
\item{outputmargin}{whether the prediction should be shown in the original
|
\item{outputmargin}{whether the prediction should be shown in the original
|
||||||
value of sum of functions, when outputmargin=TRUE, the prediction is
|
value of sum of functions, when outputmargin=TRUE, the prediction is
|
||||||
untransformed margin value. In logistic regression, outputmargin=T will
|
untransformed margin value. In logistic regression, outputmargin=T will
|
||||||
@ -22,6 +24,8 @@ output value before logistic transformation.}
|
|||||||
\item{ntreelimit}{limit number of trees used in prediction, this parameter is
|
\item{ntreelimit}{limit number of trees used in prediction, this parameter is
|
||||||
only valid for gbtree, but not for gblinear. set it to be value bigger
|
only valid for gbtree, but not for gblinear. set it to be value bigger
|
||||||
than 0. It will use all trees by default.}
|
than 0. It will use all trees by default.}
|
||||||
|
|
||||||
|
\item{predleaf}{whether predict leaf index instead. If set to TRUE, the output will be a matrix object.}
|
||||||
}
|
}
|
||||||
\description{
|
\description{
|
||||||
Predicted values based on xgboost model object.
|
Predicted values based on xgboost model object.
|
||||||
|
|||||||
@ -5,8 +5,8 @@
|
|||||||
\title{Cross Validation}
|
\title{Cross Validation}
|
||||||
\usage{
|
\usage{
|
||||||
xgb.cv(params = list(), data, nrounds, nfold, label = NULL,
|
xgb.cv(params = list(), data, nrounds, nfold, label = NULL,
|
||||||
missing = NULL, showsd = TRUE, metrics = list(), obj = NULL,
|
missing = NULL, prediction = FALSE, showsd = TRUE, metrics = list(),
|
||||||
feval = NULL, verbose = T, ...)
|
obj = NULL, feval = NULL, verbose = T, ...)
|
||||||
}
|
}
|
||||||
\arguments{
|
\arguments{
|
||||||
\item{params}{the list of parameters. Commonly used ones are:
|
\item{params}{the list of parameters. Commonly used ones are:
|
||||||
@ -34,6 +34,8 @@ xgb.cv(params = list(), data, nrounds, nfold, label = NULL,
|
|||||||
|
|
||||||
\item{missing}{Missing is only used when input is dense matrix, pick a float}
|
\item{missing}{Missing is only used when input is dense matrix, pick a float}
|
||||||
|
|
||||||
|
\item{prediction}{A logical value indicating whether to return the prediction vector.}
|
||||||
|
|
||||||
\item{showsd}{\code{boolean}, whether show standard deviation of cross validation}
|
\item{showsd}{\code{boolean}, whether show standard deviation of cross validation}
|
||||||
|
|
||||||
\item{metrics,}{list of evaluation metrics to be used in corss validation,
|
\item{metrics,}{list of evaluation metrics to be used in corss validation,
|
||||||
|
|||||||
@ -37,7 +37,7 @@ test <- agaricus.test
|
|||||||
bst <- xgboost(data = train$data, label = train$label, max.depth = 2,
|
bst <- xgboost(data = train$data, label = train$label, max.depth = 2,
|
||||||
eta = 1, nround = 2,objective = "binary:logistic")
|
eta = 1, nround = 2,objective = "binary:logistic")
|
||||||
# save the model in file 'xgb.model.dump'
|
# save the model in file 'xgb.model.dump'
|
||||||
xgb.dump(bst, 'xgb.model.dump', with.stats = T)
|
xgb.dump(bst, 'xgb.model.dump', with.stats = TRUE)
|
||||||
|
|
||||||
# print the model without saving it to a file
|
# print the model without saving it to a file
|
||||||
print(xgb.dump(bst))
|
print(xgb.dump(bst))
|
||||||
|
|||||||
@ -38,7 +38,8 @@ There are 3 columns :
|
|||||||
data(agaricus.train, package='xgboost')
|
data(agaricus.train, package='xgboost')
|
||||||
data(agaricus.test, package='xgboost')
|
data(agaricus.test, package='xgboost')
|
||||||
|
|
||||||
#Both dataset are list with two items, a sparse matrix and labels (labels = outcome column which will be learned).
|
#Both dataset are list with two items, a sparse matrix and labels
|
||||||
|
#(labels = outcome column which will be learned).
|
||||||
#Each column of the sparse Matrix is a feature in one hot encoding format.
|
#Each column of the sparse Matrix is a feature in one hot encoding format.
|
||||||
train <- agaricus.train
|
train <- agaricus.train
|
||||||
test <- agaricus.test
|
test <- agaricus.test
|
||||||
|
|||||||
@ -44,7 +44,8 @@ The content of the \code{data.table} is organised that way:
|
|||||||
\examples{
|
\examples{
|
||||||
data(agaricus.train, package='xgboost')
|
data(agaricus.train, package='xgboost')
|
||||||
|
|
||||||
#Both dataset are list with two items, a sparse matrix and labels (labels = outcome column which will be learned).
|
#Both dataset are list with two items, a sparse matrix and labels
|
||||||
|
#(labels = outcome column which will be learned).
|
||||||
#Each column of the sparse Matrix is a feature in one hot encoding format.
|
#Each column of the sparse Matrix is a feature in one hot encoding format.
|
||||||
train <- agaricus.train
|
train <- agaricus.train
|
||||||
|
|
||||||
|
|||||||
@ -5,7 +5,7 @@
|
|||||||
\title{Plot a boosted tree model}
|
\title{Plot a boosted tree model}
|
||||||
\usage{
|
\usage{
|
||||||
xgb.plot.tree(feature_names = NULL, filename_dump = NULL, model = NULL,
|
xgb.plot.tree(feature_names = NULL, filename_dump = NULL, model = NULL,
|
||||||
n_first_tree = NULL, CSSstyle = NULL)
|
n_first_tree = NULL, CSSstyle = NULL, width = NULL, height = NULL)
|
||||||
}
|
}
|
||||||
\arguments{
|
\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}.}
|
\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}.}
|
||||||
@ -17,6 +17,10 @@ xgb.plot.tree(feature_names = NULL, filename_dump = NULL, model = NULL,
|
|||||||
\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{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{CSSstyle}{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.}
|
\item{CSSstyle}{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.}
|
||||||
|
|
||||||
|
\item{width}{the width of the diagram in pixels.}
|
||||||
|
|
||||||
|
\item{height}{the height of the diagram in pixels.}
|
||||||
}
|
}
|
||||||
\value{
|
\value{
|
||||||
A \code{DiagrammeR} of the model.
|
A \code{DiagrammeR} of the model.
|
||||||
@ -40,7 +44,8 @@ It uses \href{https://github.com/knsv/mermaid/}{Mermaid} library for that purpos
|
|||||||
\examples{
|
\examples{
|
||||||
data(agaricus.train, package='xgboost')
|
data(agaricus.train, package='xgboost')
|
||||||
|
|
||||||
#Both dataset are list with two items, a sparse matrix and labels (labels = outcome column which will be learned).
|
#Both dataset are list with two items, a sparse matrix and labels
|
||||||
|
#(labels = outcome column which will be learned).
|
||||||
#Each column of the sparse Matrix is a feature in one hot encoding format.
|
#Each column of the sparse Matrix is a feature in one hot encoding format.
|
||||||
train <- agaricus.train
|
train <- agaricus.train
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user