- params
List of XGBoost parameters which control the model building process.
See the online documentation
and the documentation for xgb.params() for details.
Should be passed as list with named entries. Parameters that are not specified in this
list will use their default values.
A list of named parameters can be created through the function xgb.params(), which
accepts all valid parameters as function arguments.
- data
Training dataset. xgb.train() accepts only an xgb.DMatrix as the input.
Note that there is a function xgboost() which is meant to accept R data objects
as inputs, such as data frames and matrices.
- nrounds
Max number of boosting iterations.
- evals
Named list of xgb.DMatrix datasets to use for evaluating model performance.
Metrics specified in either eval_metric (under params) or custom_metric (function
argument here) will be computed for each of these datasets during each boosting iteration,
and stored in the end as a field named evaluation_log in the resulting object.
When either verbose>=1 or xgb.cb.print.evaluation() callback is engaged, the performance
results are continuously printed out during the training.
E.g., specifying evals=list(validation1=mat1, validation2=mat2) allows to track
the performance of each round's model on mat1 and mat2.
- objective
Customized objective function. Should take two arguments: the first one will be the
current predictions (either a numeric vector or matrix depending on the number of targets / classes),
and the second one will be the data DMatrix object that is used for training.
It should return a list with two elements grad and hess (in that order), as either
numeric vectors or numeric matrices depending on the number of targets / classes (same
dimension as the predictions that are passed as first argument).
- custom_metric
Customized evaluation function. Just like objective, should take two arguments,
with the first one being the predictions and the second one the data DMatrix.
Should return a list with two elements metric (name that will be displayed for this metric,
should be a string / character), and value (the number that the function calculates, should
be a numeric scalar).
Note that even if passing custom_metric, objectives also have an associated default metric that
will be evaluated in addition to it. In order to disable the built-in metric, one can pass
parameter disable_default_eval_metric = TRUE.
- verbose
If 0, xgboost will stay silent. If 1, it will print information about performance.
If 2, some additional information will be printed out.
Note that setting verbose > 0 automatically engages the
xgb.cb.print.evaluation(period=1) callback function.
- print_every_n
When passing verbose>0, evaluation logs (metrics calculated on the
data passed under evals) will be printed every nth iteration according to the value passed
here. The first and last iteration are always included regardless of this 'n'.
Only has an effect when passing data under evals and when passing verbose>0. The parameter
is passed to the xgb.cb.print.evaluation() callback.
- early_stopping_rounds
Number of boosting rounds after which training will be stopped
if there is no improvement in performance (as measured by the evaluatiation metric that is
supplied or selected by default for the objective) on the evaluation data passed under
evals.
Must pass evals in order to use this functionality. Setting this parameter adds the
xgb.cb.early.stop() callback.
If NULL, early stopping will not be used.
- maximize
If feval and early_stopping_rounds are set, then this parameter must be set as well.
When it is TRUE, it means the larger the evaluation score the better.
This parameter is passed to the xgb.cb.early.stop() callback.
- save_period
When not NULL, model is saved to disk after every save_period rounds.
0 means save at the end. The saving is handled by the xgb.cb.save.model() callback.
- save_name
the name or path for periodically saved model file.
- xgb_model
A previously built model to continue the training from.
Could be either an object of class xgb.Booster, or its raw data, or the name of a
file with a previously saved model.
- callbacks
A list of callback functions to perform various task during boosting.
See xgb.Callback(). Some of the callbacks are automatically created depending on the
parameters' values. User can provide either existing or their own callback methods in order
to customize the training process.
Note that some callbacks might try to leave attributes in the resulting model object,
such as an evaluation log (a data.table object) - be aware that these objects are kept
as R attributes, and thus do not get saved when using XGBoost's own serializaters like
xgb.save() (but are kept when using R serializers like saveRDS()).
- ...
Not used.
Some arguments that were part of this function in previous XGBoost versions are currently
deprecated or have been renamed. If a deprecated or renamed argument is passed, will throw
a warning (by default) and use its current equivalent instead. This warning will become an
error if using the 'strict mode' option.
If some additional argument is passed that is neither a current function argument nor
a deprecated or renamed argument, a warning or error will be thrown depending on the
'strict mode' option.
Important: ... will be removed in a future version, and all the current
deprecation warnings will become errors. Please use only arguments that form part of
the function signature.