Explainer interface
The main entry point is shap_bpt.Explainer.
Creating an explainer¶
explainer = shap_bpt.Explainer(
fm=f_masked,
image_to_explain=image,
num_explained_classes=4,
balance_area=False,
verbose=False,
)
Parameters¶
fmBlack-box masking function.
image_to_explainImage to explain. In practice, BPT construction expects
uint8image data.num_explained_classesNumber of top predicted outputs to explain.
balance_areaWhether to include an area-based priority adjustment during recursive refinement.
verboseEnables progress reporting.
Computing explanations¶
shap_values = explainer.explain_instance(
max_evals=1000,
method="BPT",
bpt=None,
batch_size=64,
verbose_plot=False,
pbar=None,
min_area=1,
max_weight=None,
)
Selected arguments¶
max_evalsBudget controlling how many masked evaluations are used.
methodEither
"BPT"or"AA".bptOptional precomputed BPT object.
batch_sizeNumber of masks evaluated together.
min_areaStop splitting regions smaller than this area.
max_weightOptional early stopping criterion based on coalition weight.