Trains an Extreme Gradient Boosting (XGBoost) model using caret::train
for binary classification.
Value
A caret::train
object representing the trained XGBoost model.
Examples
# \donttest{
set.seed(42)
n_obs <- 50
X_toy <- data.frame(
FeatureA = rnorm(n_obs),
FeatureB = runif(n_obs, 0, 100)
)
y_toy <- factor(sample(c("Control", "Case"), n_obs, replace = TRUE),
levels = c("Control", "Case"))
# Train the model
xb_model <- xb_dia(X_toy, y_toy)
print(xb_model)
#> eXtreme Gradient Boosting
#>
#> 50 samples
#> 2 predictor
#> 2 classes: 'Control', 'Case'
#>
#> No pre-processing
#> Resampling: Cross-Validated (5 fold)
#> Summary of sample sizes: 40, 40, 40, 40, 40
#> Resampling results:
#>
#> ROC Sens Spec
#> 0.5666667 0.45 0.6666667
#>
#> Tuning parameter 'nrounds' was held constant at a value of 100
#> Tuning
#> held constant at a value of 1
#> Tuning parameter 'subsample' was held
#> constant at a value of 1
# }