| xgb.model.parameters<- | R Documentation |
Only the setter for XGBoost parameters is currently implemented.
xgb.model.parameters(object) <- value
object |
Object of class |
value |
A list (or an object coercible to a list) with the names of parameters to set and the elements corresponding to parameter values. |
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.
The same booster object, which gets modified in-place.
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)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.