remove default value for nrounds

This commit is contained in:
unknown 2014-08-27 22:12:30 -07:00
parent 4723b8c07e
commit 8a4e66299a
3 changed files with 9 additions and 9 deletions

View File

@ -1,5 +1,5 @@
# train a model using given parameters
xgb.train <- function(params=list(), dtrain, nrounds = 10, watchlist = list(),
xgb.train <- function(params=list(), dtrain, nrounds, watchlist = list(),
obj = NULL, feval = NULL, ...) {
if (typeof(params) != "list") {
stop("xgb.train: first argument params must be list")

View File

@ -1,5 +1,5 @@
# Main function for xgboost-package
xgboost <- function(data = NULL, label = NULL, params = list(), nrounds = 10,
xgboost <- function(data = NULL, label = NULL, params = list(), nrounds,
verbose = 1, ...) {
inClass <- class(data)
if (inClass == "dgCMatrix" || inClass == "matrix") {

View File

@ -46,27 +46,27 @@ dtrain <- xgb.DMatrix(dense.x, label = y)
############################ Test xgboost with local file, sparse matrix and dense matrix in R.
# Test with DMatrix object
bst <- xgboost(data = dtrain, max_depth = 2, eta = 1,
bst <- xgboost(data = dtrain, max_depth = 2, eta = 1, nround = 2,
objective = "binary:logistic")
# Verbose = 0,1,2
bst <- xgboost(data = dtrain, max_depth = 2, eta = 1,
bst <- xgboost(data = dtrain, max_depth = 2, eta = 1, nround = 2,
objective = "binary:logistic", verbose = 0)
bst <- xgboost(data = dtrain, max_depth = 2, eta = 1,
bst <- xgboost(data = dtrain, max_depth = 2, eta = 1, nround = 2,
objective = "binary:logistic", verbose = 1)
bst <- xgboost(data = dtrain, max_depth = 2, eta = 1,
bst <- xgboost(data = dtrain, max_depth = 2, eta = 1, nround = 2,
objective = "binary:logistic", verbose = 2)
# Test with local file
bst <- xgboost(data = "agaricus.txt.train", max_depth = 2, eta = 1,
bst <- xgboost(data = "agaricus.txt.train", max_depth = 2, eta = 1,nround = 2,
objective = "binary:logistic")
# Test with Sparse Matrix
bst <- xgboost(data = x, label = y, max_depth = 2, eta = 1,
bst <- xgboost(data = x, label = y, max_depth = 2, eta = 1, nround = 2,
objective = "binary:logistic")
# Test with dense Matrix
bst <- xgboost(data = dense.x, label = y, max_depth = 2, eta = 1,
bst <- xgboost(data = dense.x, label = y, max_depth = 2, eta = 1, nround = 2,
objective = "binary:logistic")