Skip to content

Commit

Permalink
color update
Browse files Browse the repository at this point in the history
  • Loading branch information
tpoisot committed Oct 13, 2023
1 parent 9c3b95a commit 9346eeb
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions slides.qmd
Original file line number Diff line number Diff line change
Expand Up @@ -63,9 +63,9 @@ See also @higino2021 for more quality 🦝 content
include(joinpath("code", "pkg.jl")); # Dependencies
include(joinpath("code", "nbc.jl")); # Naive Bayes Classifier
include(joinpath("code", "bioclim.jl")); # BioClim model
include(joinpath("code", "confusion.jl")); # Confusion matrix utilities
include(joinpath("code", "splitters.jl")); # Cross-validation
include(joinpath("code", "crossvalidate.jl")); # Cross-validation
include(joinpath("code", "confusion.jl")); # Confusion matrix utilities
include(joinpath("code", "variableselection.jl")); # Variable selection
include(joinpath("code", "shapley.jl")); # Shapley values
include(joinpath("code", "palettes.jl")); # Color palettes
Expand Down Expand Up @@ -636,7 +636,7 @@ end
fig = Figure(; resolution=(900, 500))
ax = Axis(fig[1,1]; xlabel="Longitude", ylabel="Latitude", aspect=DataAspect())
hm = heatmap!(ax, entropy.(prediction), colormap=Reverse(:linear_gow_65_90_c35_n256), colorrange=(0., 1.))
hm = heatmap!(ax, entropy.(prediction), colormap=cgrad(iridescent), colorrange=(0., 1.))
heatmap!(ax, presence_layer; colormap=[:black,:black])
Colorbar(fig[1,2], hm; tellheight=false)
current_figure()
Expand Down Expand Up @@ -677,7 +677,7 @@ shapval = [similar(first(predictors)) for i in eachindex(available_variables)]
Threads.@threads for k in keys(shapval[1])
x = [p[k] for p in predictors[available_variables]]
for i in axes(shapval, 1)
shapval[i][k] = shapleyvalues(finalmodel, tX, x, i; M=50)
shapval[i][k] = shapleyvalues(finalmodel, tX[:,available_variables], x, i; M=50)
if isnan(shapval[i][k])
shapval[i][k] = 0.0
end
Expand Down Expand Up @@ -715,19 +715,19 @@ fpos = 1
for i in sortperm(varimp; rev=true)[1:3]
ax_mp = Axis(gl[fpos,1]) # Absolute contribution
scl = maximum(abs.(extrema(shapval[i]))).*(-1,1)
heatmap!(ax_mp, shapval[i], colorrange=scl, colormap=Reverse(:diverging_bwr_20_95_c54_n256), aspect=DataAspect())
hidexdecorations!(ax_mp)
heatmap!(ax_mp, shapval[i], colorrange=scl, colormap=cgrad(sunset), aspect=DataAspect())
hidexdecorations!(ax_mp)nightfall
hideydecorations!(ax_mp)
ax_pp = Axis(gl[fpos,2]) # Relative contribution
relcon = abs(shapval[i])/totalvar
heatmap!(ax_pp, relcon, colorrange=extrema(relcon), colormap=Reverse(:linear_gow_65_90_c35_n256), aspect=DataAspect())
heatmap!(ax_pp, relcon, colorrange=extrema(relcon), colormap=cgrad(iridescent), aspect=DataAspect())
hidexdecorations!(ax_pp)
hideydecorations!(ax_pp)
ax_pr = Axis(gl[fpos,3], title=variables[available_variables[i]][2]) # Partial response
ylims!(ax_pr, scl)
hexbin!(ax_pr, predictors[available_variables[i]], shapval[i], bins=200, colormap=:linear_bgy_10_95_c74_n256)
hexbin!(ax_pr, predictors[available_variables[i]], shapval[i], bins=200, colormap=cgrad(incandescent))
fpos += 1
end
Expand Down

0 comments on commit 9346eeb

Please sign in to comment.