# \donttest{
# --- Example for a Diagnosis Model ---
set.seed(123)
train_dia_data <- data.frame(
SampleID = paste0("S", 1:100),
Label = sample(c(0, 1), 100, replace = TRUE),
FeatureA = rnorm(100, 10, 2),
FeatureB = runif(100, 0, 5)
)
model_results <- list(
sample_score = data.frame(ID = paste0("S", 1:100), score = runif(100, 0, 1))
)
# Generate SHAP plot object
shap_plot <- figure_shap(
data = model_results,
raw_data = train_dia_data,
target_type = "diagnosis",
model_type = "xgboost"
)
# To display the plot:
# print(shap_plot)
# }
Run the code above in your browser using DataLab