marcoancona / DeepExplain

A unified framework of perturbation and gradient-based attribution methods for Deep Neural Networks interpretability. DeepExplain also includes support for Shapley Values sampling. (ICLR 2018)
https://arxiv.org/abs/1711.06104
MIT License
729 stars 133 forks source link

xs and ys are required to have the same length #48

Open schulter opened 5 years ago

schulter commented 5 years ago

Hi, It seems that xs and ys are required to have the same length according to _check_input_compatibility() in methods.py. Do you know why that is the case? I try to run deepExplain for a graph convolutional network where the adjacency matrix of the graph is passed as additional input (so the model has multiple inputs) but it performs a simple binary classification task. Therefore, I thought ys has shape (batch x 1) and xs is quite independent of that and has different inputs.

I ran the method in the past using masking of the target T but now wanted to switch to the explainer API since I have to run it for a lot of different data points. As far as I understood, the input placeholders have to remain the same in order to re-use the same computational graph.

Can I therefore just remove the check that requires the length of xs and ys to be the same? Why is that required in the first place?

Thank you and best, Roman

marcoancona commented 5 years ago

Hello, That check is intended to verify that the batch size is the same. If you have multiple inputs than the len() does not verify the batch size indeed, but rather the number of inputs. So this is a problem in the code, yes. You can try removing this.