RAP
RAP
Bases: Explainer
Computes Relative Attribute Propagation (RAP) explanations for a given model.
Supported Modules: Linear
, Convolution
Parameters:
Name | Type | Description | Default |
---|---|---|---|
model |
Model
|
The model for which RAP explanations are computed. |
required |
Reference
Woo-Jeoung Nam, Shir Gur, Jaesik Choi, Lior Wolf, Seong-Whan Lee. Relative Attributing Propagation: Interpreting the Comparative Contributions of Individual Units in Deep Neural Networks.
Source code in pnpxai/explainers/rap/attribute.py
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 |
|
attribute(inputs, targets, *args, **kwargs)
Computes RAP attributions for the given inputs.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
inputs |
DataSource
|
The input data. |
required |
targets |
DataSource
|
The target labels. |
required |
*args |
Any
|
Additional positional arguments. |
()
|
**kwargs |
Any
|
Additional keyword arguments. |
{}
|
Returns:
Name | Type | Description |
---|---|---|
DataSource |
DataSource
|
RAP attributions. |
Source code in pnpxai/explainers/rap/attribute.py
49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 |
|
compute_pred(output)
Computes the predicted class probabilities.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
output |
Tensor
|
The model output. |
required |
Returns:
Name | Type | Description |
---|---|---|
Tensor |
Tensor
|
The one-hot encoded predicted class probabilities. |
Source code in pnpxai/explainers/rap/attribute.py
31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 |
|