Functional API Reference

This page contains the reference for the functional API of attribench. The functional API is generally easier to use for simple cases, but note that the functional API does not support multi-GPU computations.

If you want to run a large-scale benchmarking experiment on multiple GPUs, you should use the attribench object-oriented API instead.

General

attribench.functional.select_samples(model, ...)

Select correctly classified samples from a dataset and optionally write them to a HDF5 file.

attribench.functional.train_adversarial_patches(...)

Train adversarial patches for a given model and dataset.

attribench.functional.compute_attributions(...)

Compute attributions for a given model and dataset using a dictionary of attribution methods, and optionally write them to a HDF5 file.

Metrics

attribench.functional.metrics.deletion(...)

Computes the Deletion metric for a given AttributionsDataset and model.

attribench.functional.metrics.insertion(...)

Computes the Insertion metric for a given AttributionsDataset and model.

attribench.functional.metrics.impact_coverage(...)

Computes the Impact Coverage metric for a given dataset, model, and set of attribution methods.

attribench.functional.metrics.irof(model, ...)

Computes the IROF metric for a given AttributionsDataset and model.

attribench.functional.metrics.infidelity(...)

Computes the Infidelity metric for a given AttributionsDataset and model.

attribench.functional.metrics.max_sensitivity(...)

Computes the Max-Sensitivity metric for a given Dataset and attribution methods.

attribench.functional.metrics.minimal_subset(...)

Computes Minimal Subset Deletion or Insertion for a given AttributionsDataset and model.

attribench.functional.metrics.sensitivity_n(...)

Computes the Sensitivity-n metric for a given AttributionsDataset and model.