Skip to content

Commit e2edd7f

Browse files
committed
Change default heatmap color scheme to seismic
for attribution methods such as `LRP` and `InputTimesGradient`
1 parent 5ebafe3 commit e2edd7f

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

src/heatmap.jl

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22

33
const HEATMAPPING_PRESETS = Dict{Symbol,Tuple{ColorScheme,Symbol,Symbol}}(
44
# Analyzer => (colorscheme, reduce, rangescale)
5-
:LRP => (ColorSchemes.bwr, :sum, :centered), # attribution
6-
:InputTimesGradient => (ColorSchemes.bwr, :sum, :centered), # attribution
5+
:LRP => (ColorSchemes.seismic, :sum, :centered), # attribution
6+
:InputTimesGradient => (ColorSchemes.seismic, :sum, :centered), # attribution
77
:Gradient => (ColorSchemes.grays, :norm, :extrema), # gradient
88
)
99

@@ -20,7 +20,7 @@ Assumes Flux's WHCN convention (width, height, color channels, batch size).
2020
## Keyword arguments
2121
- `cs::ColorScheme`: ColorScheme that is applied.
2222
When calling `heatmap` with an `Explanation` or analyzer, the method default is selected.
23-
When calling `heatmap` with an array, the default is `ColorSchemes.bwr`.
23+
When calling `heatmap` with an array, the default is `ColorSchemes.seismic`.
2424
- `reduce::Symbol`: How the color channels are reduced to a single number to apply a colorscheme.
2525
The following methods can be selected, which are then applied over the color channels
2626
for each "pixel" in the attribution:
@@ -32,7 +32,7 @@ Assumes Flux's WHCN convention (width, height, color channels, batch size).
3232
- `rangescale::Symbol`: How the color channel reduced heatmap is normalized before the colorscheme is applied.
3333
Can be either `:extrema` or `:centered`.
3434
When calling `heatmap` with an `Explanation` or analyzer, the method default is selected.
35-
When calling `heatmap` with an array, the default for use with the `bwr` colorscheme is `:centered`.
35+
When calling `heatmap` with an array, the default for use with the `seismic` colorscheme is `:centered`.
3636
- `permute::Bool`: Whether to flip W&H input channels. Default is `true`.
3737
- `unpack_singleton::Bool`: When heatmapping a batch with a single sample, setting `unpack_singleton=true`
3838
will return an image instead of an Vector containing a single image.
@@ -41,7 +41,7 @@ Assumes Flux's WHCN convention (width, height, color channels, batch size).
4141
"""
4242
function heatmap(
4343
attr::AbstractArray{T,N};
44-
cs::ColorScheme=ColorSchemes.bwr,
44+
cs::ColorScheme=ColorSchemes.seismic,
4545
reduce::Symbol=:sum,
4646
rangescale::Symbol=:centered,
4747
permute::Bool=true,

0 commit comments

Comments
 (0)