quantus.helpers.plotting module

This module provides some plotting functionality.

quantus.helpers.plotting.plot_focus(results: Dict[str, List[float]], *args, **kwargs) None

Plot the Focus experiment as done in the paper:

References:

1) Arias-Duart, Anna, et al. ‘Focus! Rating XAI Methods and Finding Biases. arXiv:2109.15035 (2022)”

Parameters:
results: dict

A dictionary with the Focus scores obtained using different feature attribution methods.

args: optional

Arguments.

kwargs: optional

Keyword arguments.

Returns:
None
quantus.helpers.plotting.plot_model_parameter_randomisation_experiment(results: Dict[str, dict], methods=None, *args, **kwargs) None

Plot the model parameter randomisation experiment as done in paper:

References:

1) Adebayo, J., Gilmer, J., Muelly, M., Goodfellow, I., Hardt, M., and Kim, B. “Sanity Checks for Saliency Maps.” arXiv preprint, arXiv:1810.073292v3 (2018)

Parameters:
results: list, dict

The results fromm the Selectivity experiment(s).

args: optional

Arguments.

kwargs: optional

Keyword arguments.

Returns:
None
quantus.helpers.plotting.plot_pixel_flipping_experiment(y_batch: ndarray, scores: List[Any], single_class: int | None = None, *args, **kwargs) None

Plot the pixel-flipping experiment as done in paper:

References:

1) Bach, Sebastian, et al. “On pixel-wise explanations for non-linear classifier decisions by layer-wise relevance propagation.” PloS one 10.7 (2015): e0130140.

Parameters:
y_batch: np.ndarray

The list of true labels.

scores: list

The list of evalution scores.

single_class: integer, optional

An integer to specify the label to plot.

args: optional

Arguments.

kwargs: optional

Keyword arguments.

Returns:
None
quantus.helpers.plotting.plot_region_perturbation_experiment(results: Dict[str, List[Any]], *args, **kwargs) None

Plot the region perturbation experiment as done in paper:

References:

1) Samek, Wojciech, et al. “Evaluating the visualization of what a deep neural network has learned.” IEEE transactions on neural networks and learning systems 28.11 (2016): 2660-2673.

Parameters:
results: list, dict

The results fromm the Selectivity experiment(s).

args: optional

Arguments.

kwargs: optional

Keyword arguments.

Returns:
None
quantus.helpers.plotting.plot_selectivity_experiment(results: Dict[str, List[Any]], *args, **kwargs) None

Plot the selectivity experiment as done in paper:

References:

1) Montavon, Grégoire, Wojciech Samek, and Klaus-Robert Müller. “Methods for interpreting and understanding deep neural networks.” Digital Signal Processing 73 (2018): 1-15.

Parameters:
results: list, dict

The results fromm the Selectivity experiment(s).

args: optional

Arguments.

kwargs: optional

Keyword arguments.

Returns:
None
quantus.helpers.plotting.plot_sensitivity_n_experiment(results: List[float] | Dict[str, List[float]], *args, **kwargs) None

Plot the sensitivity n experiment as done in paper:

References:

1) Ancona, Marco, et al. “Towards better understanding of gradient-based attribution methods for deep neural networks.” arXiv preprint arXiv:1711.06104 (2017).

Parameters:
results: list, dict

The results fromm the Selectivity experiment(s).

args: optional

Arguments.

kwargs: optional

Keyword arguments.

Returns:
None