interpret icon indicating copy to clipboard operation
interpret copied to clipboard

2d PDP Z-axis colours appear too similar

Open emrynHofmannElephant opened this issue 2 years ago • 2 comments

Hi, not sure if this is always the case, or just when the interactions don't provide much value, but the colours within the explainability dashboard (and when you export them) are very flat. Perhaps instead of using the scores_range here, something else should be used?

https://github.com/interpretml/interpret/blob/bf111b59bf8acb9943d8763664b769573434ebdb/python/interpret-core/interpret/visual/plot.py#L654

At the moment I've fixed the issue within a function which exports the individual plots:

fig = model.explain_global().visualize(key)
# Reformat the plot - autoscale, and if it is a heatmap (2d PDP) rescale the Z value
fig["layout"]["yaxis"].update(autorange=True)
if hasattr(fig.data[0], "z"): # Checks if there's Z values 
    fig = fig.update_traces(
        zmin=np.min(fig.data[0].z)-(0.5*np.abs(np.min(fig.data[0].z))), # Set zmin as the min plotted, minus a little bit
        zmax=np.max(fig.data[0].z)+(0.5*np.abs(np.max(fig.data[0].z))), # Set zmax as the max plotted, plus a little bit
        selector=dict(type='heatmap') # Only apply this to heatmaps
    )

Where key is an iterator from a loop of indices

Before the change: image After: image

(not the best example, due to this pdp being quite flat, but even in the case of a 2x2 plot, it looked flat, but there is a difference between z values)

emrynHofmannElephant avatar May 01 '24 21:05 emrynHofmannElephant

Hi @emrynHofmannElephant -- I think the color scale could be improved by using the maximum absolute score of the pairs instead of the existing scores_range. We have a previous issue for this. The underlying problem is that the EBM visualizations use the maximum absolute score for both pairs and mains, but often the pair score range is smaller than for the mains.

https://github.com/interpretml/interpret/issues/236

paulbkoch avatar May 02 '24 00:05 paulbkoch

Closing as duplicate of #236

emrynHofmannElephant avatar Dec 16 '24 12:12 emrynHofmannElephant