Skip to content

Commit 63d7f60

Browse files
committed
Update README
1 parent ab158ae commit 63d7f60

File tree

1 file changed

+14
-13
lines changed

1 file changed

+14
-13
lines changed

README.md

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -16,26 +16,25 @@ allowing you to automatically compute heatmaps for vision and language models.
1616
It also allows you to use input-augmentations from [ExplainableAI.jl][url-explainableai].
1717

1818
## Interface description
19-
This only requires you to fulfill the following two requirements:
19+
XAIBase only requires you to fulfill the following two requirements:
2020

21-
1. An XAI method has to be a subtype of `AbstractXAIMethod`
22-
2. An XAI method has to implement the following method:
21+
1. An XAI algorithm has to be a subtype of [`AbstractXAIMethod`][docs-abstractxaimethod]
22+
2. An XAI algorithm has to implement the following method:
2323

2424
```julia
2525
(method::MyMethod)(input, output_selector::AbstractOutputSelector)
2626
```
2727

28-
* The method has to return an [`Explanation`][docs-explanation]
29-
* The input is expected to have a batch dimensions as its last dimension
30-
* When applied to a batch, the method returns a single [`Explanation`][docs-explanation],
28+
* the method has to return an [`Explanation`][docs-explanation]
29+
* the input is expected to have a batch dimensions as its last dimension
30+
* when applied to a batch, the method returns a single [`Explanation`][docs-explanation],
3131
which contains the batched output in the `val` field.
32-
* `AbstractOutputSelector`s are predefined callable structs
33-
that select a single scalar value from a model's output,
34-
e.g. the maximally activated output of a classifier using [`XAIBase.MaxActivationSelector`][docs-maxactivationselector]
35-
or a specific output using [`XAIBase.IndexSelector`][docs-indexselector].
32+
* [`AbstractOutputSelector`][docs-abstractoutputselector]
33+
are predefined callable structs that select scalar values from a model's output,
34+
e.g. the maximally activated output of a classifier using [`MaxActivationSelector`][docs-maxactivationselector].
3635

3736
Refer to the [`Explanation`][docs-explanation] documentation for a description of the expected fields.
38-
For more information, take a look at [`src/XAIBase.jl`](https://github.com/Julia-XAI/XAIBase.jl/blob/main/src/XAIBase.jl).
37+
For more information, take a look at the [documentation][docs].
3938

4039
## Example implementation
4140
Julia-XAI methods will usually follow the following template:
@@ -50,8 +49,8 @@ function (method::MyMethod)(input, output_selector::AbstractOutputSelector)
5049
output_selection = output_selector(output)
5150

5251
val = ... # your method's implementation
53-
extras = nothing # or some additional information
54-
return Explanation(val, output, output_selection, :MyMethod, :sensitivity, extras)
52+
extras = nothing # optionally add additional information using a named tuple
53+
return Explanation(val, output, output_selection, :MyMethod, :attribution, extras)
5554
end
5655
```
5756

@@ -69,5 +68,7 @@ end
6968
[docs-extensions]: https://pkgdocs.julialang.org/v1/creating-packages/#Conditional-loading-of-code-in-packages-(Extensions)
7069
[docs]: https://julia-xai.github.io/XAIDocs/XAIBase/stable/
7170
[docs-explanation]: https://julia-xai.github.io/XAIDocs/XAIBase/stable/api/#XAIBase.Explanation
71+
[docs-abstractxaimethod]: https://julia-xai.github.io/XAIDocs/XAIBase/stable/api/#XAIBase.AbstractXAIMethod
72+
[docs-abstractoutputselector]: https://julia-xai.github.io/XAIDocs/XAIBase/stable/api/#XAIBase.AbstractOutputSelector
7273
[docs-maxactivationselector]: https://julia-xai.github.io/XAIDocs/XAIBase/stable/api/#XAIBase.MaxActivationSelector
7374
[docs-indexselector]: https://julia-xai.github.io/XAIDocs/XAIBase/stable/api/#XAIBase.IndexSelector

0 commit comments

Comments
 (0)