Skip to contents

Only the setter for XGBoost parameters is currently implemented.

Usage

xgb.model.parameters(object) <- value

Arguments

object

Object of class xgb.Booster. Will be modified in-place.

value

A list (or an object coercible to a list) with the names of parameters to set and the elements corresponding to parameter values.

Value

The same booster object, which gets modified in-place.

Details

Just like xgb.attr(), this function will make in-place modifications on the booster object which do not follow typical R assignment semantics - that is, all references to the same booster will also be updated, unlike assingment of R attributes which follow copy-on-write semantics.

See xgb.copy.Booster() for an example of this behavior.

Be aware that setting parameters of a fitted booster related to training continuation / updates will reset its number of rounds indicator to zero.

Examples

data(agaricus.train, package = "xgboost")

train <- agaricus.train

bst <- xgb.train(
  data = xgb.DMatrix(train$data, label = train$label, nthread = 1),
  nrounds = 2,
  params = xgb.params(
    max_depth = 2,
    learning_rate = 1,
    nthread = 2,
    objective = "binary:logistic"
  )
)

xgb.model.parameters(bst) <- list(learning_rate = 0.1)