Skip to content

Commit

Permalink
Update XAIBase compatibility (#7)
Browse files Browse the repository at this point in the history
  • Loading branch information
adrhill authored Jul 27, 2024
1 parent be939ee commit 72790f2
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,5 @@ ColorSchemes = "3"
Colors = "0.12"
Crayons = "4"
FixedPointNumbers = "0.8"
XAIBase = "3"
XAIBase = "3,4"
julia = "1.6"
7 changes: 4 additions & 3 deletions test/test_xaibase.jl
Original file line number Diff line number Diff line change
@@ -1,20 +1,21 @@
using XAIBase

input = 42
val = output = [1 6; 2 5; 3 4]
text = [["Test", "Text", "Heatmap"], ["another", "dummy", "input"]]
output_selection = [CartesianIndex(1, 2), CartesianIndex(3, 4)] # irrelevant
expl = Explanation(val, output, output_selection, :Gradient, :sensitivity)
expl = Explanation(val, input, output, output_selection, :Gradient, :sensitivity)
h = heatmap(expl, text)
@test_reference "references/Gradient1.txt" repr("text/plain", h[1])
@test_reference "references/Gradient2.txt" repr("text/plain", h[2])

expl = Explanation(
val[:, 1:1], output[:, 1:1], output_selection[1], :Gradient, :sensitivity
val[:, 1:1], input, output[:, 1:1], output_selection[1], :Gradient, :sensitivity
)
h = heatmap(expl, text[1])
@test_reference "references/Gradient1.txt" repr("text/plain", only(h))

expl = Explanation(val, output, output_selection, :LRP, :attribution)
expl = Explanation(val, input, output, output_selection, :LRP, :attribution)
h = heatmap(expl, text)
@test_reference "references/LRP1.txt" repr("text/plain", h[1])
@test_reference "references/LRP2.txt" repr("text/plain", h[2])
Expand Down

0 comments on commit 72790f2

Please sign in to comment.