Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ranges of output values of different explainers and visualization of relevances and used colormaps #856

Open
elboyran opened this issue Sep 25, 2024 · 7 comments
Assignees

Comments

@elboyran
Copy link
Contributor

elboyran commented Sep 25, 2024

The RISE relevances are always positive.

Then why do we display also blue in the color-map for example in the MNIST tutorial and generic tutorial? They don't look scaled properly!

Is the KernelSHAP inside the dashboard calculated properly? Again only positive values, but blue in the dashboard example. In the notebook, it looks correct.

Became more obvious by adding the heatmap colormap explanation to the dashboard Image page (still inside the work in progress PR #855 ):
image

image

Also, RISE relevances for the Tabular sunshine prediction regression task are not scaled correctly (we do not have such a tutorial).
image
The RISE relevances for row 10 are not scaled 0 to 1.
image

The last relevances are calculated in dashboard/_models_tabular.py according to Laura.

Probably other errors like these can be spotted in the dashboard....

UPDATE: will not be addressed in this project, but included in the next one (if funded)!

@elboyran elboyran added the bug Something isn't working label Sep 25, 2024
@elboyran elboyran added the unforeseen extra Unforeseen task needed to complete existing sprint tasks label Sep 27, 2024
@elboyran
Copy link
Contributor Author

Is this a result of the unsolved issue #784?

@SarahAlidoost
Copy link
Contributor

SarahAlidoost commented Sep 27, 2024

The RISE relevances are always positive.

Then why do we display also blue in the color-map for example in the MNIST tutorial and generic tutorial? They don't look scaled properly!

By default, in plot_image, the heatmap_cmap variable is set to 'bwr' (blue-white-red). As a result, matplotlib automatically scales the values across this color spectrum, even if all values are positive. I see that in the generic tutorial notebook, heatmap_cmap is also set to 'bwr'. If you prefer not to display blue in the heatmap, you can adjust the colormap to use only red, see matplotlib colormaps. Being able to set heatmap_cmap is useful when comparing the results of different methods, such as KernelSHAP and RISE.

@elboyran
Copy link
Contributor Author

Leon:

I think Sarah described it nicely already. RISE gives 0-1 values, but that doesn't mean that all values are in favour of a given class.
Close to 0 should still mean negative, so should be blue.

@elboyran
Copy link
Contributor Author

elboyran commented Sep 27, 2024

For the dashboard, though, and I would say for the notebooks too, the normalization and scale should be consistent.

Please, read my (proposal) description for the dashboard (in issue ⁠#816) explaining the scaling and colormaps, the description should align with the heatmaps people will look at just under the text. Side-by-side maps beg for comparison and we cannot compare things if the scale for one is [-1 1] and the other not even [0 1] (as it is for the text), let alone run to non-normalized values (for the RISE tabular example) such as hundreds and thousands. Beyond the dashboard, our notebooks are not consistent with the output scales (some actually display the [-1, 1] under the heatmap, others don't (while the scale is really different))!

I would like the default colormap (and value ranges) to be -1 = darkest blue, 0 = white, and 1 = darkest red. For RISE- either only red (like the text now) or 0 = darkest blue, 0.5 - white, and 1 = darkest red (and change the text notebooks and in the dashboard)

@SarahAlidoost
Copy link
Contributor

I would like the default colormap (and value ranges) to be -1 = darkest blue, 0 = white, and 1 = darkest red. For RISE- either only red (like the text now) or 0 = darkest blue, 0.5 - white, and 1 = darkest red (and change the text notebooks and in the dashboard)

In this case, you can use the argument heatmap_range=(0, 1) in the plot function for RISE, and heatmap_range=(-1, 1) for other methods. However, the appearance of the resulting plot will depend on the values of the heatmap in the examples, some small, see the plots below. Alternatively, the heatmap values can be scaled to either (0, 1) or (-1, 1) before plotting. But the results will be the same.

mnist_screenshot

Or in other notebook, where heatmaps are very small values:
overview_screenshots

@elboyran
Copy link
Contributor Author

I guess scaling the actual values (so the scaler on the side of the image is (0,1) (for RISE) and [-1,1] for the other 2, and bwr is the best choice?

We should make sure all relevances are scaled ([-1, 1] for LIME and KernelSHAP and [0,1] for RISE) in all tutorials and in the dashboard. For all modalities (also text).

Who has time to implement these small, but in several places changes?

@loostrum
Copy link
Member

loostrum commented Sep 28, 2024

Why not scale RISE to -1,1 as well? This scaling needs some thought as well, the average value of the heatmap isn't necessarily the neutral (i.e white) value. See also #784

@elboyran elboyran added must have and removed bug Something isn't working blocking unforeseen extra Unforeseen task needed to complete existing sprint tasks labels Oct 2, 2024
@elboyran elboyran changed the title Visualization of RISE and KernalSHAP relevances Ranges of output values of different explainers and visualization of relevances and used colormaps Oct 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants