hmda.fastcompute.globalwmshap: Fast Computation of Global WMSHAP Values

View source: R/hmda.fastcompute.globalwmshap.R

hmda.fastcompute.globalwmshapR Documentation

Fast Computation of Global WMSHAP Values

Description

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.

Usage

hmda.fastcompute.globalwmshap(
  model_ids,
  model_performance,
  newdata,
  x,
  performance_metric = c("aucpr", "auc", "logloss", "r2")
)

Arguments

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 "aucpr", "auc", "logloss", and "r2". The input is case-insensitive. For "aucpr", "auc", and "r2", higher values receive larger weights. For "logloss", lower values receive larger weights.

Details

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.

Value

A list with the following components:

importance

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.

model_shap_table

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.


HMDA documentation built on Sept. 18, 2026, 5:06 p.m.