View source: R/hmda.fastcompute.globalwmshap.R
| hmda.fastcompute.globalwmshap | R Documentation |
Computes global weighted mean SHAP (WMSHAP) values from a set of retained H2O models. For each model, SHAP contribution values are computed on a new dataset and summarized as mean absolute SHAP values. These values are normalized within each model to obtain model-specific SHAP importance ratios. The ratios are then combined using model weights derived from a selected performance metric.
hmda.fastcompute.globalwmshap(
model_ids,
model_performance,
newdata,
x,
performance_metric = c("aucpr", "auc", "logloss", "r2")
)
model_ids |
Character vector of H2O model IDs. |
model_performance |
A named numeric vector of model performance values. The names must correspond to the model IDs. These values are used to compute the model weights. |
newdata |
An H2OFrame containing the data on which SHAP contributions should be computed. |
x |
A character vector of predictor names. Only these columns are used when computing and summarizing SHAP values. |
performance_metric |
Character string specifying the metric used for
weighting the retained models. Supported values are |
Global WMSHAP is computed by first normalizing mean absolute SHAP values within each retained model and then taking the performance-weighted mean of these model-specific SHAP ratios.
If fewer than two model IDs are supplied, the function returns missing WMSHAP values. This is intentional because WMSHAP is defined here as a multi-model summary.
A list with the following components:
A data frame with one row per predictor. It contains the predictor name, the performance-weighted mean absolute SHAP value, the global WMSHAP ratio, and the WMSHAP rank.
A long-format data frame containing the model-specific SHAP summaries before aggregation. It includes the model ID, performance metric, model weight, model performance, predictor name, mean absolute SHAP value, and within-model SHAP importance ratio.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.