Trains an Extreme Gradient Boosting (XGBoost) model using caret::train
for binary classification.
Arguments
- X
A data frame of features.
- y
A factor vector of class labels.
- tune
Logical, whether to perform hyperparameter tuning using
caret's default grid (ifTRUE) or use fixed values (ifFALSE).- cv_folds
An integer, the number of cross-validation folds for
caret.- tune_length
An integer, the number of random parameter combinations to try when tune=TRUE. Only used when search="random". Default is 20.
Value
A caret::train object representing the trained XGBoost model.