Configuration¶
This page describes how to configure the transparency module that computes and visualises attributions.
Inside the transparency key, you can configure one or more explainers. See Examples for the config shape.
See Supported libraries for the backend behaviour behind
_target_, algorithm, and visualiser compatibility.
RAITAP has two separate batch-size controls because predictions and explanations are different workload stages:
data.forward_batch_sizecontrols the model forward pass used for predictions, metrics, report sample selection, andcall.target: auto_pred.transparency.<explainer>.raitap.batch_sizecontrols attribution computation for that explainer. Expensive methods such as SHAP or Captum Occlusion often need a much smaller attribution batch size than the prediction batch size.
Options¶
Name |
Allowed |
Default |
Description |
|---|---|---|---|
|
|
|
Hydra target for the explainer class. |
|
|
Name of the underlying explainability algorithm to use. The exact class is resolved by the selected explainer backend. |
|
|
|
|
Keyword arguments passed when constructing the explainer or underlying library object. |
|
|
|
Keyword arguments passed verbatim to the underlying library when computing attributions. Any nested dict with a |
|
|
|
RAITAP-owned runtime options such as batching, progress display, and sample-name metadata. These keys are not forwarded to the underlying explainability library. |
|
|
|
Batch size for computing attributions. If not specified, the explainer will compute attributions in a single pass. This controls only the explainer attribution stage. It does not control the initial prediction forward pass used for metrics, report sample ranking, or |
|
|
|
Whether to show a progress bar when computing attributions. |
|
|
|
Description of the progress bar. |
|
|
|
Optional per-sample names for downstream visualisers. This can be injected at runtime from the data pipeline. If runtime sample names are provided, they take precedence over |
|
|
|
Default toggle for showing sample names in visualiser titles. Set the explainer-level default here under |
|
|
|
Input modality + layout hints used by output-space inference and visualiser selection. Keys: |
|
|
|
Library-agnostic baseline / reference input for attribution methods that take one (Captum |
|
|
|
Visualiser definitions. Each entry must include at least |
Examples¶
transparency:
my_first_explainer:
_target_: "CaptumExplainer"
algorithm: "IntegratedGradients"
call:
target: 0
raitap:
baseline:
source: "./data/baseline"
input_metadata:
kind: image
layout: NCHW
visualisers:
- _target_: "CaptumImageVisualiser"
call:
max_samples: 1
my_second_explainer:
_target_: "ShapExplainer"
algorithm: "KernelExplainer"
call:
target: 0
raitap:
baseline:
source: "./data/background"
n_samples: 32
batch_size: 1
input_metadata:
kind: tabular
layout: "(B,F)"
feature_names: [age, income, score]
visualisers:
- _target_: "ShapBarVisualiser"
from raitap.transparency import captum, captum_image, shap, shap_bar
transparency = {
"my_first_explainer": captum(
algorithm="IntegratedGradients",
call={"target": 0},
raitap={
"baseline": {"source": "./data/baseline"}, # routed to Captum's `baselines`
"input_metadata": {"kind": "image", "layout": "NCHW"},
},
visualisers=[captum_image(call={"max_samples": 1})],
),
"my_second_explainer": shap(
algorithm="KernelExplainer",
call={"target": 0},
raitap={
"baseline": {"source": "./data/background", "n_samples": 32},
"batch_size": 1,
"input_metadata": {
"kind": "tabular",
"layout": "(B,F)",
"feature_names": ["age", "income", "score"],
},
},
visualisers=[shap_bar()],
),
}
uv run raitap transparency.captum_ig.algorithm=GradientShap
raitap transparency.captum_ig.algorithm=GradientShap