Skip to contents

Shapley feature attributions for one instance (sampling estimator)

Usage

morie_fairness_xai_shap_values(
  predict_fn,
  x,
  background,
  feature_names = NULL,
  n_samples = 200L,
  seed = 0L
)

Arguments

predict_fn

Function mapping (n, d) matrix to n predictions.

x

Numeric vector of length d (the instance).

background

Reference matrix (n_bg, d) for marginal averaging.

feature_names

Optional character vector.

n_samples

Number of random permutations averaged.

seed

Reproducibility seed.

Value

morie_fairness_result; $value is the largest-magnitude SHAP value.