| train.xgboost | R Documentation |
This function wraps xgb.train to standardize model
training within the traineR framework. It automatically handles preprocessing,
parameter configuration, multiclass settings, and metadata generation for predictions.
train.xgboost(
formula,
data,
nrounds,
evals = list(),
custom_metric = NULL,
verbose = 1,
print_every_n = 1L,
early_stopping_rounds = NULL,
maximize = NULL,
save_period = NULL,
save_name = "xgboost.model",
xgb_model = NULL,
callbacks = list(),
eval_metric = NULL,
extra_params = NULL,
booster = "gbtree",
objective = NULL,
eta = 0.3,
gamma = 0,
max_depth = 6,
min_child_weight = 1,
subsample = 1,
colsample_bytree = 1,
...
)
formula |
A model formula describing the response and predictors. |
data |
A data frame containing the training data. Internally, it is converted to
an |
nrounds |
Maximum number of boosting iterations. |
evals |
A named list of |
custom_metric |
A custom evaluation function for xgboost. |
verbose |
Controls verbosity: |
print_every_n |
Print evaluation results every |
early_stopping_rounds |
Number of rounds with no improvement before stopping. |
maximize |
Logical indicating if the evaluation metric should be maximized. |
save_period |
Save the model every |
save_name |
File name for saving the model. |
xgb_model |
A previously trained xgboost model for continuation. |
callbacks |
A list of callback functions for xgboost during training. |
eval_metric |
Evaluation metric for xgboost (e.g., |
extra_params |
Optional list of additional xgboost parameters. |
booster |
Booster type: |
objective |
Objective function for xgboost. If
|
eta |
Learning rate. Default is 0.3. |
gamma |
Minimum loss reduction for a split. Default is 0. |
max_depth |
Maximum depth of trees. Default is 6. |
min_child_weight |
Minimum sum of instance weight in a child. |
subsample |
Subsample ratio for training instances. Default is 1. |
colsample_bytree |
Subsample ratio of columns per tree. Default is 1. |
... |
Additional arguments for |
An object of class xgb.Booster.prmdt containing:
The trained xgboost model.
Metadata used by traineR for prediction output.
xgb.train, xgb.DMatrix
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.