refine style with max.depth
This commit is contained in:
parent
1925321a16
commit
9e3b878943
@ -10,7 +10,7 @@
|
|||||||
#' \item \code{binary:logistic} logistic regression for classification
|
#' \item \code{binary:logistic} logistic regression for classification
|
||||||
#' }
|
#' }
|
||||||
#' \item \code{eta} step size of each boosting step
|
#' \item \code{eta} step size of each boosting step
|
||||||
#' \item \code{max_depth} maximum depth of the tree
|
#' \item \code{max.depth} maximum depth of the tree
|
||||||
#' \item \code{nthread} number of thread used in training, if not set, all threads are used
|
#' \item \code{nthread} number of thread used in training, if not set, all threads are used
|
||||||
#' }
|
#' }
|
||||||
#'
|
#'
|
||||||
@ -50,7 +50,7 @@
|
|||||||
#' data(agaricus.train, package='xgboost')
|
#' data(agaricus.train, package='xgboost')
|
||||||
#' dtrain <- xgb.DMatrix(agaricus.train$data, label = agaricus.train$label)
|
#' dtrain <- xgb.DMatrix(agaricus.train$data, label = agaricus.train$label)
|
||||||
#' history <- xgb.cv(data = dtrain, nround=3, nfold = 5, metrics=list("rmse","auc"),
|
#' history <- xgb.cv(data = dtrain, nround=3, nfold = 5, metrics=list("rmse","auc"),
|
||||||
#' "max_depth"=3, "eta"=1, "objective"="binary:logistic")
|
#' "max.depth"=3, "eta"=1, "objective"="binary:logistic")
|
||||||
#' @export
|
#' @export
|
||||||
#'
|
#'
|
||||||
xgb.cv <- function(params=list(), data, nrounds, nfold, label = NULL,
|
xgb.cv <- function(params=list(), data, nrounds, nfold, label = NULL,
|
||||||
|
|||||||
@ -10,7 +10,7 @@
|
|||||||
#' \item \code{binary:logistic} logistic regression for classification
|
#' \item \code{binary:logistic} logistic regression for classification
|
||||||
#' }
|
#' }
|
||||||
#' \item \code{eta} step size of each boosting step
|
#' \item \code{eta} step size of each boosting step
|
||||||
#' \item \code{max_depth} maximum depth of the tree
|
#' \item \code{max.depth} maximum depth of the tree
|
||||||
#' \item \code{nthread} number of thread used in training, if not set, all threads are used
|
#' \item \code{nthread} number of thread used in training, if not set, all threads are used
|
||||||
#' }
|
#' }
|
||||||
#'
|
#'
|
||||||
@ -50,7 +50,7 @@
|
|||||||
#' dtrain <- xgb.DMatrix(agaricus.train$data, label = agaricus.train$label)
|
#' dtrain <- xgb.DMatrix(agaricus.train$data, label = agaricus.train$label)
|
||||||
#' dtest <- dtrain
|
#' dtest <- dtrain
|
||||||
#' watchlist <- list(eval = dtest, train = dtrain)
|
#' watchlist <- list(eval = dtest, train = dtrain)
|
||||||
#' param <- list(max_depth = 2, eta = 1, silent = 1)
|
#' param <- list(max.depth = 2, eta = 1, silent = 1)
|
||||||
#' logregobj <- function(preds, dtrain) {
|
#' logregobj <- function(preds, dtrain) {
|
||||||
#' labels <- getinfo(dtrain, "label")
|
#' labels <- getinfo(dtrain, "label")
|
||||||
#' preds <- 1/(1 + exp(-preds))
|
#' preds <- 1/(1 + exp(-preds))
|
||||||
|
|||||||
@ -14,7 +14,7 @@
|
|||||||
#' \item \code{binary:logistic} logistic regression for classification
|
#' \item \code{binary:logistic} logistic regression for classification
|
||||||
#' }
|
#' }
|
||||||
#' \item \code{eta} step size of each boosting step
|
#' \item \code{eta} step size of each boosting step
|
||||||
#' \item \code{max_depth} maximum depth of the tree
|
#' \item \code{max.depth} maximum depth of the tree
|
||||||
#' \item \code{nthread} number of thread used in training, if not set, all threads are used
|
#' \item \code{nthread} number of thread used in training, if not set, all threads are used
|
||||||
#' }
|
#' }
|
||||||
#'
|
#'
|
||||||
|
|||||||
@ -15,7 +15,7 @@ xgb.cv(params = list(), data, nrounds, nfold, label = NULL, showsd = TRUE,
|
|||||||
\item \code{binary:logistic} logistic regression for classification
|
\item \code{binary:logistic} logistic regression for classification
|
||||||
}
|
}
|
||||||
\item \code{eta} step size of each boosting step
|
\item \code{eta} step size of each boosting step
|
||||||
\item \code{max_depth} maximum depth of the tree
|
\item \code{max.depth} maximum depth of the tree
|
||||||
\item \code{nthread} number of thread used in training, if not set, all threads are used
|
\item \code{nthread} number of thread used in training, if not set, all threads are used
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -67,6 +67,6 @@ This function only accepts an \code{xgb.DMatrix} object as the input.
|
|||||||
data(agaricus.train, package='xgboost')
|
data(agaricus.train, package='xgboost')
|
||||||
dtrain <- xgb.DMatrix(agaricus.train$data, label = agaricus.train$label)
|
dtrain <- xgb.DMatrix(agaricus.train$data, label = agaricus.train$label)
|
||||||
history <- xgb.cv(data = dtrain, nround=3, nfold = 5, metrics=list("rmse","auc"),
|
history <- xgb.cv(data = dtrain, nround=3, nfold = 5, metrics=list("rmse","auc"),
|
||||||
"max_depth"=3, "eta"=1, "objective"="binary:logistic")
|
"max.depth"=3, "eta"=1, "objective"="binary:logistic")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -15,7 +15,7 @@ xgb.train(params = list(), data, nrounds, watchlist = list(), obj = NULL,
|
|||||||
\item \code{binary:logistic} logistic regression for classification
|
\item \code{binary:logistic} logistic regression for classification
|
||||||
}
|
}
|
||||||
\item \code{eta} step size of each boosting step
|
\item \code{eta} step size of each boosting step
|
||||||
\item \code{max_depth} maximum depth of the tree
|
\item \code{max.depth} maximum depth of the tree
|
||||||
\item \code{nthread} number of thread used in training, if not set, all threads are used
|
\item \code{nthread} number of thread used in training, if not set, all threads are used
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -62,7 +62,7 @@ data(agaricus.train, package='xgboost')
|
|||||||
dtrain <- xgb.DMatrix(agaricus.train$data, label = agaricus.train$label)
|
dtrain <- xgb.DMatrix(agaricus.train$data, label = agaricus.train$label)
|
||||||
dtest <- dtrain
|
dtest <- dtrain
|
||||||
watchlist <- list(eval = dtest, train = dtrain)
|
watchlist <- list(eval = dtest, train = dtrain)
|
||||||
param <- list(max_depth = 2, eta = 1, silent = 1)
|
param <- list(max.depth = 2, eta = 1, silent = 1)
|
||||||
logregobj <- function(preds, dtrain) {
|
logregobj <- function(preds, dtrain) {
|
||||||
labels <- getinfo(dtrain, "label")
|
labels <- getinfo(dtrain, "label")
|
||||||
preds <- 1/(1 + exp(-preds))
|
preds <- 1/(1 + exp(-preds))
|
||||||
|
|||||||
@ -20,7 +20,7 @@ xgboost(data = NULL, label = NULL, params = list(), nrounds,
|
|||||||
\item \code{binary:logistic} logistic regression for classification
|
\item \code{binary:logistic} logistic regression for classification
|
||||||
}
|
}
|
||||||
\item \code{eta} step size of each boosting step
|
\item \code{eta} step size of each boosting step
|
||||||
\item \code{max_depth} maximum depth of the tree
|
\item \code{max.depth} maximum depth of the tree
|
||||||
\item \code{nthread} number of thread used in training, if not set, all threads are used
|
\item \code{nthread} number of thread used in training, if not set, all threads are used
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -162,7 +162,7 @@ evalerror <- function(preds, dtrain) {
|
|||||||
|
|
||||||
dtest <- xgb.DMatrix(test$data, label = test$label)
|
dtest <- xgb.DMatrix(test$data, label = test$label)
|
||||||
watchlist <- list(eval = dtest, train = dtrain)
|
watchlist <- list(eval = dtest, train = dtrain)
|
||||||
param <- list(max_depth = 2, eta = 1, silent = 1)
|
param <- list(max.depth = 2, eta = 1, silent = 1)
|
||||||
|
|
||||||
bst <- xgb.train(param, dtrain, nround = 2, watchlist, logregobj, evalerror)
|
bst <- xgb.train(param, dtrain, nround = 2, watchlist, logregobj, evalerror)
|
||||||
@
|
@
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user