tuneandtrainExtBoost {RobustPrediction}R Documentation

Tune and Train External Boosting

Description

This function tunes and trains a Boosting classifier using the mboost::glmboost function. It provides two strategies for tuning the number of boosting iterations (mstop) based on the estperf argument:

Usage

tuneandtrainExtBoost(
  data,
  dataext,
  estperf = FALSE,
  mstop_seq = seq(5, 1000, by = 5),
  nu = 0.1
)

Arguments

data

A data frame containing the training data. The first column should be the response variable (factor), and the remaining columns should be the predictor variables.

dataext

A data frame containing the external validation data. The first column should be the response variable (factor), and the remaining columns should be the predictor variables.

estperf

A logical value indicating whether to use internal tuning with external validation (TRUE) or external tuning (FALSE). Default is FALSE.

mstop_seq

A numeric vector specifying the sequence of boosting iterations to evaluate. Default is seq(5, 1000, by = 5).

nu

A numeric value specifying the learning rate for boosting. Default is 0.1.

Value

A list containing the following components:

Examples

# Load sample data
data(sample_data_train)
data(sample_data_extern)

# Example usage with external tuning (default)
mstop_seq <- seq(50, 500, by = 50)
result <- tuneandtrainExtBoost(sample_data_train, sample_data_extern, 
  mstop_seq = mstop_seq, nu = 0.1)
print(result$best_mstop)         # Optimal mstop
print(result$best_model)         # Trained Boosting model
# Note: est_auc is not returned when estperf = FALSE

# Example usage with internal tuning and external validation
result_internal <- tuneandtrainExtBoost(sample_data_train, sample_data_extern, 
  estperf = TRUE, mstop_seq = mstop_seq, nu = 0.1)
print(result_internal$best_mstop) # Optimal mstop
print(result_internal$best_model) # Trained Boosting model
print(result_internal$est_auc)    # AUC on external validation dataset

[Package RobustPrediction version 0.1.7 Index]