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

[Feature Request] map_to_interpret_space function for Lime and Kernel Shap #92

Closed
dejeanph opened this issue Jan 31, 2022 · 6 comments
Closed
Labels
enhancement New feature or request feature-attribution New feature or issue concerning Attribution methods

Comments

@dejeanph
Copy link
Collaborator

The methods Lime and KernelShap need a map_to_interpret_space function. By default, the function is the quickshift segmentation algorithm. For better results, watershed function on images have to be used. This algorithm, in the skimage, package needs a parameter (makers) which value is dedicated to the image treated and not for all images of the dataset.
The current API of Lime and KernelShap cannot allowed such configuration (function + dedicated value).

A solution could be to have a parameter for the image maps computed in advance instead of compute them every time in the explicability method function.

@lucashervier
Copy link
Collaborator

You want to change the default map_to_interpret_space function for LIME & KernelSHAP for images inputs to watershed. But from my understanding this new function need to be parametrized for EACH images which I do not believe make the utilisation of the library easier for someone beginning with XAI. Therefore, I do not believe that changing the default function is a good solution.

However, what we can do is to propose a pool of image segmentation algorithms including watershed. Since I am not familiar with watershed can you provide some of your workaround (in a colab notebook) in order to know exactly what you expect and how you are currently doing ?

Thanks!

@lucashervier lucashervier changed the title map_to_interpret_space function for Lime and Kernel Shap [Feature Request] map_to_interpret_space function for Lime and Kernel Shap Feb 9, 2022
@lucashervier lucashervier added enhancement New feature or request feature-attribution New feature or issue concerning Attribution methods labels Feb 9, 2022
@dejeanph
Copy link
Collaborator Author

dejeanph commented Feb 9, 2022

As I said, the watershed algorithm in the skimage package needs a parameter based on the processed image. This is difficult to include and transmit to the map_to_interpret_space function.
A solution seems to add a parameter indicating the macropixel map directly, calculated outside the XAI process.
Thus we no longer transmit the calculation function of the map but the map itself.

@RuoyuChen10
Copy link

You want to change the default map_to_interpret_space function for LIME & KernelSHAP for images inputs to watershed. But from my understanding this new function need to be parametrized for EACH images which I do not believe make the utilisation of the library easier for someone beginning with XAI. Therefore, I do not believe that changing the default function is a good solution.

However, what we can do is to propose a pool of image segmentation algorithms including watershed. Since I am not familiar with watershed can you provide some of your workaround (in a colab notebook) in order to know exactly what you expect and how you are currently doing ?

Thanks!

How to write a function? Can you give an example, please?

@AntoninPoche
Copy link
Collaborator

There is a tutorial on Lime and KernelShap with Xplique: https://colab.research.google.com/drive/1frholXRE4XQQ3W5yZuPQ2-xqc-LTczfT

Does it help in the use of map_to_interpret_space?

@dejeanph
Copy link
Collaborator Author

dejeanph commented Sep 26, 2023 via email

@AntoninPoche
Copy link
Collaborator

I agree that those methods' results are highly dependent on the segmentation. However, I did not see in the literature how to include the model in the segmentation, if you saw something and think it is necessary for the method, feel free to contribute.

However, we should keep in mind that Lime and KernelShap are black box methods, hence, the model's convolution layers cannot be taken into account, otherwise, it becomes a white box method.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request feature-attribution New feature or issue concerning Attribution methods
Projects
None yet
Development

No branches or pull requests

4 participants