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 YAML example for the config shape.

See Supported libraries for the backend behaviour behind _target_, algorithm, and visualiser compatibility.

Options

Name

Allowed

Default

Description

_target_

"CaptumExplainer", "ShapExplainer"

null

Hydra target for the explainer class.

algorithm

See Supported libraries

null

Name of the underlying explainability algorithm to use. The exact class is resolved by the selected explainer backend.

constructor

dict

null

Keyword arguments passed when constructing the explainer or underlying library object.

call

dict

null

Keyword arguments passed when computing attributions. Any nested dict with a source key is treated as a runtime data source.

call.batch_size

int

None

Batch size for computing attributions. If not specified, the explainer will compute attributions in a single pass.

call.max_batch_size

int

None

Maximum batch size for computing attributions. If not specified, the explainer will compute attributions in a single pass.

call.show_progress

bool

True

Whether to show a progress bar when computing attributions.

call.progress_desc

str

null

Description of the progress bar.

visualisers

list[dict]

[]

Visualiser definitions. Each entry must include at least _target_. Each visualiser can also define its own constructor and call blocks.

YAML example

transparency:
  my_first_explainer:
    _target_: "CaptumExplainer"
    algorithm: "IntegratedGradients"
    call:
      target: 0
    visualisers:
      - _target_: "CaptumImageVisualiser"
        call:
          max_samples: 1
  my_second_explainer:
    _target_: "ShapExplainer"
    algorithm: "GradientExplainer"
    constructor:
      local_smoothing: 0.0
    call:
      background_data:
        source: "./data/background"
        n_samples: 32
    visualisers:
      - _target_: "ShapImageVisualiser"

CLI override example

uv run raitap transparency.captum_ig.algorithm=GradientShap
raitap transparency.captum_ig.algorithm=GradientShap