tl_fit_xgboost: Fit an XGBoost model

View source: R/supervised-xgboost.R

tl_fit_xgboostR Documentation

Fit an XGBoost model

Description

Fit an XGBoost model

Usage

tl_fit_xgboost(
  data,
  formula,
  is_classification = FALSE,
  nrounds = 100,
  max_depth = 6,
  eta = 0.3,
  subsample = 1,
  colsample_bytree = 1,
  min_child_weight = 1,
  gamma = 0,
  alpha = 0,
  lambda = 1,
  early_stopping_rounds = NULL,
  nthread = NULL,
  verbose = 0,
  ...
)

Arguments

data

A data frame containing the training data

formula

A formula specifying the model

is_classification

Logical indicating if this is a classification problem

nrounds

Number of boosting rounds (default: 100)

max_depth

Maximum depth of trees (default: 6)

eta

Learning rate (default: 0.3)

subsample

Subsample ratio of observations (default: 1)

colsample_bytree

Subsample ratio of columns (default: 1)

min_child_weight

Minimum sum of instance weight needed in a child (default: 1)

gamma

Minimum loss reduction to make a further partition (default: 0)

alpha

L1 regularization term (default: 0)

lambda

L2 regularization term (default: 1)

early_stopping_rounds

Early stopping rounds (default: NULL)

nthread

Number of threads (default: max available)

verbose

Verbose output (default: 0)

...

Additional arguments to pass to xgb.train()

Value

A fitted XGBoost model


tidylearn documentation built on Feb. 6, 2026, 5:07 p.m.