# \donttest{
# Assuming `bagging_results` and `test_dia` are available from previous steps
# bagging_model <- bagging_results$model_object
# Example 1: Default behavior - use the second column of test_dia as label
# predictions <- apply_dia(
# trained_model_object = bagging_model,
# new_data = test_dia
# )
# Example 2: Explicitly specify the label column by name
# predictions_explicit <- apply_dia(
# trained_model_object = bagging_model,
# new_data = test_dia,
# label_col_name = "outcome"
# )
# Example 3: Predict on data without labels
# test_data_no_labels <- test_dia[, -2] # Remove outcome column
# predictions_no_label <- apply_dia(
# trained_model_object = bagging_model,
# new_data = test_data_no_labels,
# label_col_name = NA # Explicitly disable label extraction
# )
# }
Run the code above in your browser using DataLab