remove default value for nrounds
This commit is contained in:
parent
4723b8c07e
commit
8a4e66299a
@ -1,5 +1,5 @@
|
|||||||
# train a model using given parameters
|
# 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, ...) {
|
obj = NULL, feval = NULL, ...) {
|
||||||
if (typeof(params) != "list") {
|
if (typeof(params) != "list") {
|
||||||
stop("xgb.train: first argument params must be list")
|
stop("xgb.train: first argument params must be list")
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
# Main function for xgboost-package
|
# 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, ...) {
|
verbose = 1, ...) {
|
||||||
inClass <- class(data)
|
inClass <- class(data)
|
||||||
if (inClass == "dgCMatrix" || inClass == "matrix") {
|
if (inClass == "dgCMatrix" || inClass == "matrix") {
|
||||||
|
|||||||
@ -46,27 +46,27 @@ dtrain <- xgb.DMatrix(dense.x, label = y)
|
|||||||
############################ Test xgboost with local file, sparse matrix and dense matrix in R.
|
############################ Test xgboost with local file, sparse matrix and dense matrix in R.
|
||||||
|
|
||||||
# Test with DMatrix object
|
# 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")
|
objective = "binary:logistic")
|
||||||
|
|
||||||
# Verbose = 0,1,2
|
# 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)
|
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)
|
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)
|
objective = "binary:logistic", verbose = 2)
|
||||||
|
|
||||||
# Test with local file
|
# 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")
|
objective = "binary:logistic")
|
||||||
|
|
||||||
# Test with Sparse Matrix
|
# 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")
|
objective = "binary:logistic")
|
||||||
|
|
||||||
# Test with dense Matrix
|
# 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")
|
objective = "binary:logistic")
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user