Looking for usage documentation? Check out Interpretability.
explain.permutation_shap
View source shap.PermutationExplainer with an independent
masker: a hidden feature takes its values from each background row, and
the prediction is averaged over the background rows. shap calls the
model once per explained row, so a remote model pays the request overhead
for every row. This function predicts the masked rows of many explained
rows in each call of predict_fn.
Each set of shown features is predicted once per explained row, and the
all-hidden set once in total. So the number of masked rows is at most
n_background * (1 + len(X) * (1 + 2 * n_permutations * (n_features - 1))),
and fewer when orderings share sets, which is common with few features.
ValueError
If an argument is invalid, or predict_fn returns the
wrong number of predictions.
explain.ShapExplanation
View source ShapExplanation.to_shap
View source shap.Explanation, for use with the plots of shap.
ImportError
If shap is not installed.