stacking_pro | R Documentation |
Implements a Stacking ensemble for prognostic models. It trains multiple base models and uses their predictions to train a meta-model.
stacking_pro(
results_all_models,
data,
meta_model_name,
top = 3,
tune_meta = FALSE,
time_unit = "day",
years_to_evaluate = c(1, 3, 5),
seed = 789
)
results_all_models |
A list of results from |
data |
A data frame for training the meta-model. The first column must be ID, second event status (0/1), third time, and subsequent columns features. |
meta_model_name |
A character string, the name of the meta-model to use (e.g., "lasso_pro", "gbm_pro"). This model must be registered. |
top |
An integer, the number of top-performing base models (ranked by C-index) to select for the stacking ensemble. |
tune_meta |
Logical, whether to enable tuning for the meta-model. |
time_unit |
A character string, the unit of time in the third column of |
years_to_evaluate |
A numeric vector of specific years at which to calculate time-dependent AUROC for evaluation. |
seed |
An integer, for reproducibility. |
A list containing the model_object
, sample_score
, and evaluation_metrics
.
models_pro
, evaluate_model_pro
# NOTE: This example requires the 'train_pro' dataset.
if (requireNamespace("E2E", quietly = TRUE) &&
"train_pro" %in% utils::data(package = "E2E")$results[,3]) {
data(train_pro, package = "E2E")
initialize_modeling_system_pro()
# First, generate results for base models
base_model_results <- models_pro(data = train_pro, model = c("lasso_pro", "rsf_pro"))
# Then, create the stacking ensemble
stacking_lasso_results <- stacking_pro(
results_all_models = base_model_results,
data = train_pro,
meta_model_name = "lasso_pro",
top = 3,
years_to_evaluate = c(1, 3)
)
print_model_summary_pro("Stacking (Lasso)", stacking_lasso_results)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.