You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
for my paper [1], I computed the cosine similarity using the values of self._target_contrib_vars as it includes both positive and negative contributions. However for the MaxPool2D, self._target_contrib_vars was set to zero. Is there a reason for it? Here is the code snippet:
classMaxPool2D(Pool2D):
def_build_pos_and_neg_contribs(self):
if (self.verbose):
print("Heads-up: current implementation assumes maxpool layer ""is followed by a linear transformation (conv/dense layer)")
#placeholder; not used for linear layer, hence assumption abovereturntf.zeros_like(tensor=self.get_activation_vars(),
name="dummy_pos_cont_"+str(self.get_name())),\
tf.zeros_like(tensor=self.get_activation_vars(),
name="dummy_neg_cont_"+str(self.get_name()))
As a fix, I changed it to return pos and neg contributions:
It would not break the behavior of other layers because, as you might have guessed from the comment, the value of those tensors only matter when the layer is followed by a nonlinearity; therefore, long as the maxpooling layer is followed by a linear transformation, those tensors do not affect the calculation of the multipliers. That’s why I used placeholder values.
Yes, use of a pooling mask would be the ideal way to deal with this - however, as long as the maxpooling layer is followed by a linear layer, you will also get correct attributions if you simply treat the difference-from-reference as the pos_contribs and set the neg_contribs to zero; this is because pos_mxts=neg_mxts if the maxpooling layer were followed by a linear layer, as discussed in Section 3.4 of the DeepLIFT paper. Thus, given that _target_contrib_vars is found as pos_contribs*pos_mxts + neg_contribs*neg_mxts, and pos_mxts=neg_mxts when a layer is followed by a linear layer, I think the following fix should work:
Hi Avanti,
for my paper [1], I computed the cosine similarity using the values of
self._target_contrib_vars
as it includes both positive and negative contributions. However for the MaxPool2D,self._target_contrib_vars
was set to zero. Is there a reason for it? Here is the code snippet:As a fix, I changed it to return pos and neg contributions:
I hope this does not break anything. What would be the correct behavior? To incorporate the pooling mask?
Cheers,
Leon
The text was updated successfully, but these errors were encountered: